pip
这个错误在公共testnet和私人网络的开发过程中不断重复,只有1个矿工。这对前者来说是有意义的,因为有竞争条件,而且矿工和天然气价格的上涨可能有所帮助,但为什么它发生在我的私人网络上,交易很少且采矿难度很低?
我使用web3js info: Error: Transaction was not mined within 50 blocks, please make sure your transaction was properly send. Be aware that it might still be mined!
at /opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-method/src/index.js:375:45
at tryCatcher (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:497:31)
at Promise._settlePromise (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:555:18)
at Promise._settlePromise0 (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:600:10)
at Promise._settlePromises (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/promise.js:679:18)
at Async._drainQueue (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/async.js:125:16)
at Async._drainQueues (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/async.js:135:10)
at Immediate.Async.drainQueues (/opt/bkzcoin_project/bkzcoin-backend/node_modules/web3-core-promievent/node_modules/bluebird/js/release/async.js:16:14)
at runCallback (timers.js:800:20)
at tryOnImmediate (timers.js:762:5)
at processImmediate [as _immediateCallback] (timers.js:733:5)
方法发送两种类型的交易:
send
其中 /** executes contract method by creating transaction
* @param {string} from - payer address
* @param {string} to - payee address
* @param {int} amount - number of tokens
* @param {string} type - transaction type
*/
transferTokens(from, to, amount, type) {
if (type === 'transfer_to_admin' || type === 'transfer_from_user') {
return this.contract.methods.transferFrom(from, to, amount).send({ from })
.catch((err) => {
logger.info(err);
return Promise.reject(err);
});
}
if (type === 'transfer_from_admin') {
return this.contract.methods.transfer(to, amount).send({ 'from': this.coinbase })
.catch((error) => {
logger.info(error);
return Promise.reject(error);
});
}
}
和transfer
是由ERC20标准实施的Solidity函数。
任何人都知道如何避免/处理此错误?