1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Stop removing old shapeshift txs

This commit is contained in:
Dan Finlay 2017-02-04 15:15:50 -08:00
parent af439cc6cf
commit 89bbccb09c

View File

@ -4,9 +4,6 @@ const extend = require('xtend')
// every three seconds when an incomplete tx is waiting // every three seconds when an incomplete tx is waiting
const POLLING_INTERVAL = 3000 const POLLING_INTERVAL = 3000
// drop txs that haven't been paid to in 11 mins
const TIMEOUT_LIMIT = 660000
class ShapeshiftController { class ShapeshiftController {
constructor (opts = {}) { constructor (opts = {}) {
@ -27,24 +24,11 @@ class ShapeshiftController {
} }
getPendingTxs () { getPendingTxs () {
this.removeOldTxs()
const txs = this.getShapeShiftTxList() const txs = this.getShapeShiftTxList()
const pending = txs.filter(tx => tx.response && tx.response.status !== 'complete') const pending = txs.filter(tx => tx.response && tx.response.status !== 'complete')
return pending return pending
} }
removeOldTxs() {
const { shapeShiftTxList } = this.store.getState()
const now = new Date().getTime()
const old = shapeShiftTxList.find((tx) => {
return tx.time + TIMEOUT_LIMIT < now &&
tx.response && tx.response.status === 'no_deposits'
})
if (old) {
old.forEach(tx => this.removeShapeShiftTx(tx))
}
}
pollForUpdates () { pollForUpdates () {
const pendingTxs = this.getPendingTxs() const pendingTxs = this.getPendingTxs()