check for the tx in the block that provider engine gives us

feature/default_network_editable
frankiebee 8 years ago
parent 56490c6468
commit 6ae97290f0
  1. 20
      app/scripts/controllers/transactions.js
  2. 2
      package.json

@ -338,12 +338,13 @@ module.exports = class TransactionController extends EventEmitter {
// checks if a signed tx is in a block and // checks if a signed tx is in a block and
// if included sets the tx status as 'confirmed' // if included sets the tx status as 'confirmed'
checkForTxInBlock () { checkForTxInBlock (block) {
var signedTxList = this.getFilteredTxList({status: 'submitted'}) var signedTxList = this.getFilteredTxList({status: 'submitted'})
if (!signedTxList.length) return if (!signedTxList.length) return
signedTxList.forEach((txMeta) => { signedTxList.forEach((txMeta) => {
var txHash = txMeta.hash var txHash = txMeta.hash
var txId = txMeta.id var txId = txMeta.id
if (!txHash) { if (!txHash) {
const errReason = { const errReason = {
errCode: 'No hash was provided', errCode: 'No hash was provided',
@ -351,20 +352,9 @@ module.exports = class TransactionController extends EventEmitter {
} }
return this.setTxStatusFailed(txId, errReason) return this.setTxStatusFailed(txId, errReason)
} }
this.query.getTransactionByHash(txHash, (err, txParams) => {
if (err || !txParams) { block.transactions.forEach((tx) => {
if (!txParams) return if (tx.hash === txHash) this.setTxStatusConfirmed(txId)
txMeta.err = {
isWarning: true,
errorCode: err,
message: 'There was a problem loading this transaction.',
}
this.updateTx(txMeta)
return log.error(err)
}
if (txParams.blockNumber) {
this.setTxStatusConfirmed(txId)
}
}) })
}) })
} }

@ -123,7 +123,7 @@
"valid-url": "^1.0.9", "valid-url": "^1.0.9",
"vreme": "^3.0.2", "vreme": "^3.0.2",
"web3": "0.18.2", "web3": "0.18.2",
"web3-provider-engine": "^13.0.0", "web3-provider-engine": "^13.0.1",
"web3-stream-provider": "^2.0.6", "web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1" "xtend": "^4.0.1"
}, },

Loading…
Cancel
Save