7

用truffle脚本部署多个合约的时候经常timeout

 2 years ago
source link: https://learnblockchain.cn/question/2867
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

用truffle脚本部署多个合约的时候经常timeout | 登链社区 | 技术问答

用truffle脚本部署多个合约的时候经常timeout

---------------------------------------
Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({
  code: -32603,
  message: 'ETIMEDOUT',
  data: { originalError: { code: 'ETIMEDOUT', connect: true } },
  stack: 'Error: ETIMEDOUT\n' +
    '    at Timeout.<anonymous> (/Users/g/contract/node_modules/request/request.js:848:19)\n' +
    '    at listOnTimeout (internal/timers.js:557:17)\n' +
    '    at processTimers (internal/timers.js:500:7)'
})
    at Web3ProviderEngine.emit (events.js:364:17)

怎么可以不报错,可以设置超时的时长吗

Tiny熊 - 布道者 16小时前

  擅长:智能合约,以太坊

你可以试试设置 truffle_config.js 设置一下 timeoutBlocks 看看.

networks: {
  development: {
    host: "127.0.0.1",
    port: 8545,
    network_id: "*", // 匹配任何网络
    websockets: true
  },
  live: {
    host: "178.25.19.88", // 用于示例目的的随机IP(不要使用)
    port: 80,
    network_id: 1,        // 以太坊主网
    // 可选配置:
    // gas
    // gasPrice
    // from - Truffle 在进行交易是的默认发送地址
    // provider -  Truffle 用来连接以太坊网络的 web3 provider 实例
    //          - 如果是一个函数,需要返回 web3 provider 实例 (参考下文)
    //          - 如果指定了provider, host 和 port 或忽略。
    // skipDryRun: - 如果不想在实际迁移之前在本地测试运行迁移,则为true(默认为false)
    // timeoutBlocks: - 如果没有交易没有挖出,保持等待的区块数(默认为50)
  }
}

参考文档: https://learnblockchain.cn/docs/truffle/reference/configuration.html

您需要登录后才可以回答问题,登录 或者 注册

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK