on master help sign in
Handle "known transaction" error during sending
1597ccdFang
src/lib/txn.js+6−3
@@ -166,8 +166,11 @@ const sendSignedTransaction = (web3, stx, doubtNonceError, confirmationCb) => {
166 // we just wait for first confirmation here.
166 // we just wait for first confirmation here.
167 console.error(err);
167 console.error(err);
168 if (
168 if (
169+ (err.message || '').includes('known transaction: ') ||
169− doubtNonceError &&
170+ (doubtNonceError &&
171+ (err.message || '').includes(
170− (err.message || '').includes("the tx doesn't have the correct nonce.")
172+ "the tx doesn't have the correct nonce."
173+ ))
171 ) {
174 ) {
172 console.log('nonce error, likely from gas tank submission, ignoring');
175 console.log('nonce error, likely from gas tank submission, ignoring');
173 const txHash = web3.utils.keccak256(rawTx);
176 const txHash = web3.utils.keccak256(rawTx);
@@ -182,7 +185,7 @@ const sendSignedTransaction = (web3, stx, doubtNonceError, confirmationCb) => {
182 }
185 }
183 });
186 });
184 } else {
187 } else {
185− reject(err.message);
188+ reject(err.message || 'Transaction sending failed!');
186 }
189 }
187 });
190 });
188 });
191 });