aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2017-09-30 08:36:49 +0800
committerGitHub <noreply@github.com>2017-09-30 08:36:49 +0800
commit7bdf73b1ddb7249907be5500b35f0b91490e1893 (patch)
treeb4490434d704d78d0ecfcdbabe5dd0db9df36b4e /app
parent8425fb04d388b5a1f46c79f5ec5f28c69d91d684 (diff)
parentac80eaca1fc9923cd5696282ba2bc6bace22ff83 (diff)
downloadtangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.tar
tangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.tar.gz
tangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.tar.bz2
tangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.tar.lz
tangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.tar.xz
tangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.tar.zst
tangerine-wallet-browser-7bdf73b1ddb7249907be5500b35f0b91490e1893.zip
Merge pull request #2233 from MetaMask/remove-accountTracker-from-transactions
pending-tx - dont check the balance to rebrodcast
Diffstat (limited to 'app')
-rw-r--r--app/scripts/controllers/transactions.js11
-rw-r--r--app/scripts/lib/pending-tx-tracker.js15
-rw-r--r--app/scripts/metamask-controller.js1
3 files changed, 1 insertions, 26 deletions
diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js
index 4f5c94675..9fdec1ead 100644
--- a/app/scripts/controllers/transactions.js
+++ b/app/scripts/controllers/transactions.js
@@ -32,7 +32,6 @@ module.exports = class TransactionController extends EventEmitter {
this.provider = opts.provider
this.blockTracker = opts.blockTracker
this.signEthTx = opts.signTransaction
- this.accountTracker = opts.accountTracker
this.memStore = new ObservableStore({})
this.query = new EthQuery(this.provider)
@@ -61,11 +60,6 @@ module.exports = class TransactionController extends EventEmitter {
provider: this.provider,
nonceTracker: this.nonceTracker,
retryLimit: 3500, // Retry 3500 blocks, or about 1 day.
- getBalance: (address) => {
- const account = this.accountTracker.store.getState().accounts[address]
- if (!account) return
- return account.balance
- },
publishTransaction: (rawTx) => this.query.sendRawTransaction(rawTx),
getPendingTransactions: this.txStateManager.getPendingTransactions.bind(this.txStateManager),
})
@@ -84,10 +78,7 @@ module.exports = class TransactionController extends EventEmitter {
this.blockTracker.on('block', this.pendingTxTracker.checkForTxInBlock.bind(this.pendingTxTracker))
// this is a little messy but until ethstore has been either
// removed or redone this is to guard against the race condition
- // where accountTracker hasent been populated by the results yet
- this.blockTracker.once('latest', () => {
- this.blockTracker.on('latest', this.pendingTxTracker.resubmitPendingTxs.bind(this.pendingTxTracker))
- })
+ this.blockTracker.on('latest', this.pendingTxTracker.resubmitPendingTxs.bind(this.pendingTxTracker))
this.blockTracker.on('sync', this.pendingTxTracker.queryPendingTxs.bind(this.pendingTxTracker))
// memstore is computed from a few different stores
this._updateMemstore()
diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js
index b97cec9ce..3d358b00e 100644
--- a/app/scripts/lib/pending-tx-tracker.js
+++ b/app/scripts/lib/pending-tx-tracker.js
@@ -1,6 +1,5 @@
const EventEmitter = require('events')
const EthQuery = require('ethjs-query')
-const sufficientBalance = require('./util').sufficientBalance
/*
Utility class for tracking the transactions as they
@@ -12,7 +11,6 @@ const sufficientBalance = require('./util').sufficientBalance
requires a: {
provider: //,
nonceTracker: //see nonce tracker,
- getBalnce: //(address) a function for getting balances,
getPendingTransactions: //() a function for getting an array of transactions,
publishTransaction: //(rawTx) a async function for publishing raw transactions,
}
@@ -25,7 +23,6 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
this.query = new EthQuery(config.provider)
this.nonceTracker = config.nonceTracker
this.retryLimit = config.retryLimit || Infinity
- this.getBalance = config.getBalance
this.getPendingTransactions = config.getPendingTransactions
this.publishTransaction = config.publishTransaction
}
@@ -99,23 +96,11 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
}
async _resubmitTx (txMeta) {
- const address = txMeta.txParams.from
- const balance = this.getBalance(address)
- if (balance === undefined) return
-
if (txMeta.retryCount > this.retryLimit) {
const err = new Error(`Gave up submitting after ${this.retryLimit} blocks un-mined.`)
return this.emit('tx:failed', txMeta.id, err)
}
- // if the value of the transaction is greater then the balance, fail.
- if (!sufficientBalance(txMeta.txParams, balance)) {
- const insufficientFundsError = new Error('Insufficient balance during rebroadcast.')
- this.emit('tx:failed', txMeta.id, insufficientFundsError)
- log.error(insufficientFundsError)
- return
- }
-
// Only auto-submit already-signed txs:
if (!('rawTx' in txMeta)) return
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index eb978115d..03e021a92 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -132,7 +132,6 @@ module.exports = class MetamaskController extends EventEmitter {
provider: this.provider,
blockTracker: this.blockTracker,
ethQuery: this.ethQuery,
- accountTracker: this.accountTracker,
})
this.txController.on('newUnaprovedTx', opts.showUnapprovedTx.bind(opts))