Don't reassign transaction in getAwaitingTransactions, check for another transaction executed with the same nonce and not only cancellation ones (#710)

This commit is contained in:
Mikhail Mikheev 2020-04-01 18:44:35 +04:00 committed by GitHub
parent 1d9683eb12
commit ef525f6da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -16,14 +16,15 @@ export const getAwaitingTransactions = (
const nonCancelledTransactions = safeTransactions.filter((transaction: Transaction) => {
// If transactions are not executed, but there's a transaction with the same nonce EXECUTED later
// it means that the transaction was cancelled (Replaced) and shouldn't get executed
let isTransactionCancelled = false
if (!transaction.isExecuted) {
if (cancellationTransactionsByNonce.get(transaction.nonce)) {
// eslint-disable-next-line no-param-reassign
transaction = transaction.set('cancelled', true)
isTransactionCancelled = true
}
}
// The transaction is not executed and is not cancelled, so it's still waiting confirmations
if (!transaction.executionTxHash && !transaction.cancelled) {
if (!transaction.executionTxHash && !isTransactionCancelled) {
// Then we check if the waiting confirmations are not from the current user, otherwise, filters this
// transaction
const transactionWaitingUser = transaction.confirmations.filter(

View File

@ -129,8 +129,9 @@ const extendedTransactionsSelector: Selector<
if (!tx.isExecuted) {
if (
cancellationTransactionsByNonce.get(tx.nonce) &&
cancellationTransactionsByNonce.get(tx.nonce).get('isExecuted')
(cancellationTransactionsByNonce.get(tx.nonce) &&
cancellationTransactionsByNonce.get(tx.nonce).get('isExecuted')) ||
transactions.find((safeTx) => tx.nonce === safeTx.nonce && safeTx.isExecuted)
) {
extendedTx = tx.set('cancelled', true)
}