check if there as a pending transaction before marking transaction as a cancellation one

This commit is contained in:
Mikhail Mikheev 2020-07-06 14:41:55 +04:00
parent 2f81edbb8e
commit ab7fab365f
1 changed files with 4 additions and 1 deletions

View File

@ -79,7 +79,10 @@ export type BatchProcessTxsProps = OutgoingTxs & {
const extractCancelAndOutgoingTxs = (safeAddress: string, outgoingTxs: TxServiceModel[]): OutgoingTxs => {
return outgoingTxs.reduce(
(acc, transaction) => {
if (isCancelTransaction(transaction, safeAddress)) {
if (
isCancelTransaction(transaction, safeAddress) &&
outgoingTxs.find((tx) => tx.nonce === transaction.nonce && !isCancelTransaction(tx, safeAddress))
) {
if (!isNaN(Number(transaction.nonce))) {
acc.cancellationTxs[transaction.nonce] = transaction
}