Merge pull request #2292 from MetaMask/rebrocast-by-timeStamp

Rebrocast by time stamp
feature/default_network_editable
Dan Finlay 7 years ago committed by GitHub
commit 833d73da56
  1. 1
      CHANGELOG.md
  2. 2
      app/scripts/controllers/transactions.js
  3. 8
      app/scripts/lib/pending-tx-tracker.js

@ -2,6 +2,7 @@
## Current Master ## Current Master
- Only rebrodcast transactions for a day not a days worth of blocks
- Remove Slack link from info page, since it is a big phishing target. - Remove Slack link from info page, since it is a big phishing target.
## 3.10.8 2017-9-28 ## 3.10.8 2017-9-28

@ -59,7 +59,7 @@ module.exports = class TransactionController extends EventEmitter {
this.pendingTxTracker = new PendingTransactionTracker({ this.pendingTxTracker = new PendingTransactionTracker({
provider: this.provider, provider: this.provider,
nonceTracker: this.nonceTracker, nonceTracker: this.nonceTracker,
retryLimit: 3500, // Retry 3500 blocks, or about 1 day. retryTimePeriod: 86400000, // Retry 3500 blocks, or about 1 day.
publishTransaction: (rawTx) => this.query.sendRawTransaction(rawTx), publishTransaction: (rawTx) => this.query.sendRawTransaction(rawTx),
getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager), getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager),
}) })

@ -22,7 +22,8 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
super() super()
this.query = new EthQuery(config.provider) this.query = new EthQuery(config.provider)
this.nonceTracker = config.nonceTracker this.nonceTracker = config.nonceTracker
this.retryLimit = config.retryLimit || Infinity // default is one day
this.retryTimePeriod = config.retryTimePeriod || 86400000
this.getPendingTransactions = config.getPendingTransactions this.getPendingTransactions = config.getPendingTransactions
this.publishTransaction = config.publishTransaction this.publishTransaction = config.publishTransaction
} }
@ -99,8 +100,9 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
} }
async _resubmitTx (txMeta) { async _resubmitTx (txMeta) {
if (txMeta.retryCount > this.retryLimit) { if (Date.now() > txMeta.time + this.retryTimePeriod) {
const err = new Error(`Gave up submitting after ${this.retryLimit} blocks un-mined.`) const hours = (this.retryTimePeriod / 3.6e+6).toFixed(1)
const err = new Error(`Gave up submitting after ${hours} hours.`)
return this.emit('tx:failed', txMeta.id, err) return this.emit('tx:failed', txMeta.id, err)
} }

Loading…
Cancel
Save