Skip to content

Commit

Permalink
fix: detect replaced rejected chain swap lockup txs
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Jan 29, 2025
1 parent c7c1f9a commit 5b75f00
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/swap/UtxoNursery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -183,7 +182,6 @@ class UtxoNursery extends TypedEventEmitter<{
outputValue,
)
) {
chainClient.removeOutputFilter(swapOutput.script);
this.emit('chainSwap.lockup.failed', {
swap,
reason: Errors.OVERPAID_AMOUNT(
Expand All @@ -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,
Expand Down Expand Up @@ -304,6 +303,7 @@ class UtxoNursery extends TypedEventEmitter<{
[Op.or]: [
SwapUpdateEvent.SwapCreated,
SwapUpdateEvent.TransactionMempool,
SwapUpdateEvent.TransactionLockupFailed,
SwapUpdateEvent.TransactionZeroConfRejected,
],
},
Expand Down

0 comments on commit 5b75f00

Please sign in to comment.