I am running a node script to initiate transactions via Web3 1.0 (beta 55), and using sendSignedTransaction
to broadcast the Tx to Infura. Every once in a while, I am getting an instant error that makes no sense. When it errors, it doesn’t get submitted, but if I try again five seconds later, it will always work. What could be going on at the node level to trigger this? I never get errors when connected to a local node, but that is probably because I’m using a different method as I’m already logged in.
If nobody knows, can I just resubmit on an error right away in the .on routine? I ask because it happens so rarely it is hard to test the behavior, and I haven’t been able to replicate. My suspicion is that it is a websocket disruption.
web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'))
.once("confirmation", function() {
console.log('*** Transaction Confirmed ***')
})
.on("error", function() {
console.log('*** Error ***')
})