mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
Merge pull request #2121 from MetaMask/i2115-DoNotFailOnRetries
Do not mark a retry tx failed that has been broadcast successfully
This commit is contained in:
commit
7094d96529
@ -2,6 +2,8 @@
|
||||
|
||||
## Current Master
|
||||
|
||||
- Fix bug that would sometimes display transactions as failed that could be successfully mined.
|
||||
|
||||
## 3.10.1 2017-9-18
|
||||
|
||||
- Add ability to export private keys as a file.
|
||||
|
@ -76,6 +76,9 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
|
||||
Dont marked as failed if the error is a "known" transaction warning
|
||||
"there is already a transaction with the same sender-nonce
|
||||
but higher/same gas price"
|
||||
|
||||
Also don't mark as failed if it has ever been broadcast successfully.
|
||||
A successful broadcast means it may still be mined.
|
||||
*/
|
||||
const errorMessage = err.message.toLowerCase()
|
||||
const isKnownTx = (
|
||||
@ -88,6 +91,7 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
|
||||
// other
|
||||
|| errorMessage.includes('gateway timeout')
|
||||
|| errorMessage.includes('nonce too low')
|
||||
|| txMeta.retryCount > 1
|
||||
)
|
||||
// ignore resubmit warnings, return early
|
||||
if (isKnownTx) return
|
||||
@ -117,10 +121,12 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
|
||||
// Only auto-submit already-signed txs:
|
||||
if (!('rawTx' in txMeta)) return
|
||||
|
||||
// Increment a try counter.
|
||||
txMeta.retryCount++
|
||||
const rawTx = txMeta.rawTx
|
||||
return await this.publishTransaction(rawTx)
|
||||
const txHash = await this.publishTransaction(rawTx)
|
||||
|
||||
// Increment successful tries:
|
||||
txMeta.retryCount++
|
||||
return txHash
|
||||
}
|
||||
|
||||
async _checkPendingTx (txMeta) {
|
||||
|
Loading…
Reference in New Issue
Block a user