From 5b75f009bd2ef5594502749ba4eca36c6f054aef Mon Sep 17 00:00:00 2001 From: michael1011 Date: Wed, 29 Jan 2025 14:17:13 -0600 Subject: [PATCH] fix: detect replaced rejected chain swap lockup txs --- lib/swap/UtxoNursery.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/swap/UtxoNursery.ts b/lib/swap/UtxoNursery.ts index a0c6d87b..dd1a3ef7 100644 --- a/lib/swap/UtxoNursery.ts +++ b/lib/swap/UtxoNursery.ts @@ -164,7 +164,6 @@ class UtxoNursery extends TypedEventEmitter<{ ); if (swap.receivingData.expectedAmount > outputValue) { - chainClient.removeOutputFilter(swapOutput.script); this.emit('chainSwap.lockup.failed', { swap, reason: Errors.INSUFFICIENT_AMOUNT( @@ -183,7 +182,6 @@ class UtxoNursery extends TypedEventEmitter<{ outputValue, ) ) { - chainClient.removeOutputFilter(swapOutput.script); this.emit('chainSwap.lockup.failed', { swap, reason: Errors.OVERPAID_AMOUNT( @@ -201,6 +199,7 @@ class UtxoNursery extends TypedEventEmitter<{ wallet, ); if (prevAddresses.some(this.blocks.isBlocked)) { + chainClient.removeOutputFilter(swapOutput.script); this.emit('chainSwap.lockup.failed', { swap, reason: Errors.BLOCKED_ADDRESS().message, @@ -304,6 +303,7 @@ class UtxoNursery extends TypedEventEmitter<{ [Op.or]: [ SwapUpdateEvent.SwapCreated, SwapUpdateEvent.TransactionMempool, + SwapUpdateEvent.TransactionLockupFailed, SwapUpdateEvent.TransactionZeroConfRejected, ], },