我使用web3js V1.0.0-beta.34以签订的交易发送到GETH节点Geth的/ v1.8.13不稳定,2e0391ea / Linux的AMD64 / go1.10.3在一个循环。
问题:在循环的初始迭代中,Node.js的打印交易散列到控制台。 但是,当循环已经运行了超过少数几秒钟,我们开始得到错误:
Error: Failed to check for transaction receipt: {} at Object._fireError (/Users/x/test/node_modules/web3-utils/src/index.js:56:17) at /Users/x/test/node_modules/web3-core-method/src/index.js:260:23 at <anonymous>
可能是什么这个问题的原因是什么?
test.js
for (var i = nonce; i < nonce + 1000; i++) {
nounce = web3.utils.numberToHex(nonce)
receivingAddr = getRandomWalletAddress()
var rawTx = {
nonce: i,
gasPrice: gasPriceHex,
gasLimit: gasLimitHex,
to: receivingAddr,
value: txValue,
data: txData
}
var tx = new Tx(rawTx);
tx.sign(key);
var serializedTx = tx.serialize();
web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'))
.on('receipt', (receipt) => {
console.log(receipt.transactionHash)
})
}