fix the maxcost not being included in txMeta
This commit is contained in:
parent
d06c54e0b7
commit
212ef0b850
|
@ -117,12 +117,14 @@ module.exports = class TransactionManager extends EventEmitter {
|
||||||
// save txMeta
|
// save txMeta
|
||||||
(cb) => {
|
(cb) => {
|
||||||
this.addTx(txMeta)
|
this.addTx(txMeta)
|
||||||
|
debugger
|
||||||
|
this.setMaxTxCostAndFee(txMeta)
|
||||||
cb(null, txMeta)
|
cb(null, txMeta)
|
||||||
},
|
},
|
||||||
], done)
|
], done)
|
||||||
}
|
}
|
||||||
|
|
||||||
getMaxTxCostAndFee (txMeta) {
|
setMaxTxCostAndFee (txMeta) {
|
||||||
var txParams = txMeta.txParams
|
var txParams = txMeta.txParams
|
||||||
|
|
||||||
var gasMultiplier = txMeta.gasMultiplier
|
var gasMultiplier = txMeta.gasMultiplier
|
||||||
|
@ -132,7 +134,9 @@ module.exports = class TransactionManager extends EventEmitter {
|
||||||
var txFee = gasCost.mul(gasPrice)
|
var txFee = gasCost.mul(gasPrice)
|
||||||
var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16)
|
var txValue = new BN(ethUtil.stripHexPrefix(txParams.value || '0x0'), 16)
|
||||||
var maxCost = txValue.add(txFee)
|
var maxCost = txValue.add(txFee)
|
||||||
return {maxCost, txFee}
|
txMeta.txValue = txValue
|
||||||
|
txMeta.maxCost = maxCost
|
||||||
|
this.updateTx(txMeta)
|
||||||
}
|
}
|
||||||
|
|
||||||
getUnapprovedTxList () {
|
getUnapprovedTxList () {
|
||||||
|
@ -263,7 +267,7 @@ module.exports = class TransactionManager extends EventEmitter {
|
||||||
setTxStatusRejected (txId) {
|
setTxStatusRejected (txId) {
|
||||||
this._setTxStatus(txId, 'rejected')
|
this._setTxStatus(txId, 'rejected')
|
||||||
}
|
}
|
||||||
|
|
||||||
// should update the status of the tx to 'approved'.
|
// should update the status of the tx to 'approved'.
|
||||||
setTxStatusApproved (txId) {
|
setTxStatusApproved (txId) {
|
||||||
this._setTxStatus(txId, 'approved')
|
this._setTxStatus(txId, 'approved')
|
||||||
|
|
Loading…
Reference in New Issue