mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
if an error happens during a tx publication set tx status to fail
This commit is contained in:
parent
47936019d2
commit
11b744bb87
@ -240,7 +240,16 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
this.updateTx(txMeta)
|
this.updateTx(txMeta)
|
||||||
|
|
||||||
this.txProviderUtils.publishTransaction(rawTx, (err, txHash) => {
|
this.txProviderUtils.publishTransaction(rawTx, (err, txHash) => {
|
||||||
if (err) return cb(err)
|
if (err) {
|
||||||
|
const errorMessage = err.message.toLowerCase()
|
||||||
|
if (errorMessage !== 'replacement transaction underpriced'
|
||||||
|
&& errorMessage !== 'gas price too low to replace'
|
||||||
|
&& !errorMessage.startsWith('known transaction')
|
||||||
|
) {
|
||||||
|
this.setTxStatusFailed(txId)
|
||||||
|
}
|
||||||
|
return cb(err)
|
||||||
|
}
|
||||||
this.setTxHash(txId, txHash)
|
this.setTxHash(txId, txHash)
|
||||||
this.setTxStatusSubmitted(txId)
|
this.setTxStatusSubmitted(txId)
|
||||||
cb()
|
cb()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user