From ec9c5283135d2cc3dcb633f19dd89ea79267f34a Mon Sep 17 00:00:00 2001 From: frankiebee Date: Thu, 5 Oct 2017 10:54:28 -0700 Subject: [PATCH 1/3] pending-tx - check time stamp instead of block number for resubmit --- app/scripts/controllers/transactions.js | 2 +- app/scripts/lib/pending-tx-tracker.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 94e04c429..a0f983deb 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -59,7 +59,7 @@ module.exports = class TransactionController extends EventEmitter { this.pendingTxTracker = new PendingTransactionTracker({ provider: this.provider, 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), getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager), }) diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js index 6f1601586..3463d45bf 100644 --- a/app/scripts/lib/pending-tx-tracker.js +++ b/app/scripts/lib/pending-tx-tracker.js @@ -22,7 +22,8 @@ module.exports = class PendingTransactionTracker extends EventEmitter { super() this.query = new EthQuery(config.provider) this.nonceTracker = config.nonceTracker - this.retryLimit = config.retryLimit || Infinity + // default is one day + this.retryTimePeriod = config.retryTimePeriod || 86400000 this.getPendingTransactions = config.getPendingTransactions this.publishTransaction = config.publishTransaction } @@ -99,8 +100,8 @@ module.exports = class PendingTransactionTracker extends EventEmitter { } async _resubmitTx (txMeta) { - if (txMeta.retryCount > this.retryLimit) { - const err = new Error(`Gave up submitting after ${this.retryLimit} blocks un-mined.`) + if (Date.now() > txMeta.time + this.retryTimePeriod) { + const err = new Error(`Gave up submitting after ${this.retryTimePeriod / 3.6e+6} hours.`) return this.emit('tx:failed', txMeta.id, err) } From 3cb9da2ae56ce0b3162e64dbcf69f5f9e39ff4e8 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Thu, 5 Oct 2017 11:42:01 -0700 Subject: [PATCH 2/3] "fix" hours for message --- app/scripts/lib/pending-tx-tracker.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js index 3463d45bf..8a626e222 100644 --- a/app/scripts/lib/pending-tx-tracker.js +++ b/app/scripts/lib/pending-tx-tracker.js @@ -101,7 +101,8 @@ module.exports = class PendingTransactionTracker extends EventEmitter { async _resubmitTx (txMeta) { if (Date.now() > txMeta.time + this.retryTimePeriod) { - const err = new Error(`Gave up submitting after ${this.retryTimePeriod / 3.6e+6} hours.`) + 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) } From 554a3ac4e4f4493f318753410bb4332204f2efb7 Mon Sep 17 00:00:00 2001 From: frankiebee Date: Thu, 5 Oct 2017 12:12:31 -0700 Subject: [PATCH 3/3] add to CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 069602915..7fc74a9d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 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. ## 3.10.8 2017-9-28