松露迁移需要太多时间

时间:2019-08-17 20:21:14

标签: blockchain truffle

嗨,我正在尝试通过在Oracle虚拟机ubuntu上使用getch迁移合同。虽然1_initial_migration.js的部署显示为Block:0 Seconds:16743并且尚未完成部署,但是还有2_deploy_contract.js。通常会花费很多时间还是在一分钟内完成部署? 怎么了?为什么1_initial_migration.js部署没有完成并开始部署2_deploy_contract.js?

松露迁移-重置-网络rinkeby

这是合同:

pragma solidity 0.4.2;

contract Election {
// Read/write candidate
string public candidate;

// Constructor
function Election () public {
    candidate = "Candidate 1";
}
}

migrations.sol

 pragma solidity >=0.4.21 <0.6.0;

 contract Migrations {
  address public owner;
  uint public last_completed_migration;

  constructor() public {
     owner = msg.sender;
  }

   modifier restricted() {
    if (msg.sender == owner) _;
   }

   function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
   }

   function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
      upgraded.setCompleted(last_completed_migration);
   }
  }

1_initial_migration.js

   const Migrations = artifacts.require("Migrations");

    module.exports = function(deployer) {
    deployer.deploy(Migrations);
    };

1 个答案:

答案 0 :(得分:0)

我在使用 geth 在私有以太坊上迁移时遇到了同样的问题。我一开始挖矿,问题就解决了。 确保您的区块正在被开采。