mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix 9435 - Allow speeding up of underpriced transactions (#9687)
This commit is contained in:
parent
1294955d81
commit
220a82b53f
@ -2,6 +2,7 @@ import { createSelector } from 'reselect'
|
|||||||
import {
|
import {
|
||||||
SUBMITTED_STATUS,
|
SUBMITTED_STATUS,
|
||||||
CONFIRMED_STATUS,
|
CONFIRMED_STATUS,
|
||||||
|
FAILED_STATUS,
|
||||||
PRIORITY_STATUS_HASH,
|
PRIORITY_STATUS_HASH,
|
||||||
PENDING_STATUS_HASH,
|
PENDING_STATUS_HASH,
|
||||||
} from '../helpers/constants/transactions'
|
} from '../helpers/constants/transactions'
|
||||||
@ -227,12 +228,13 @@ export const nonceSortedTransactionsSelector = createSelector(
|
|||||||
const nonceProps = nonceToTransactionsMap[nonce]
|
const nonceProps = nonceToTransactionsMap[nonce]
|
||||||
insertTransactionByTime(nonceProps.transactions, transaction)
|
insertTransactionByTime(nonceProps.transactions, transaction)
|
||||||
|
|
||||||
if (status in PRIORITY_STATUS_HASH) {
|
const { primaryTransaction: { time: primaryTxTime = 0 } = {} } = nonceProps
|
||||||
const { primaryTransaction: { time: primaryTxTime = 0 } = {} } = nonceProps
|
|
||||||
|
|
||||||
if (status === CONFIRMED_STATUS || txTime > primaryTxTime) {
|
const previousPrimaryIsNetworkFailure = nonceProps.primaryTransaction.status === FAILED_STATUS && nonceProps.primaryTransaction?.txReceipt?.status !== '0x0'
|
||||||
nonceProps.primaryTransaction = transaction
|
const currentTransactionIsOnChainFailure = transaction?.txReceipt?.status === '0x0'
|
||||||
}
|
|
||||||
|
if (status === CONFIRMED_STATUS || currentTransactionIsOnChainFailure || previousPrimaryIsNetworkFailure || (txTime > primaryTxTime && status in PRIORITY_STATUS_HASH)) {
|
||||||
|
nonceProps.primaryTransaction = transaction
|
||||||
}
|
}
|
||||||
|
|
||||||
const { initialTransaction: { time: initialTxTime = 0 } = {} } = nonceProps
|
const { initialTransaction: { time: initialTxTime = 0 } = {} } = nonceProps
|
||||||
|
Loading…
Reference in New Issue
Block a user