Skip to content

Commit

Permalink
fix: timeout of submarine swaps without invoice (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 authored Jan 14, 2025
1 parent 121af9a commit a47bd78
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/service/TimeoutDeltaProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,12 @@ class TimeoutDeltaProvider {
invoice,
referralId,
)
: [chainDeltas.swapMinimal, true];
: [
version === SwapVersion.Taproot
? chainDeltas.swapTaproot
: chainDeltas.swapMinimal,
true,
];
}
};

Expand Down
17 changes: 17 additions & 0 deletions test/unit/service/TimeoutDeltaProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,23 @@ describe('TimeoutDeltaProvider', () => {
),
).resolves.toEqual([8, true]);

await expect(
deltaProvider.getTimeout(
'BTC/BTC',
OrderSide.SELL,
SwapType.Submarine,
SwapVersion.Legacy,
),
).resolves.toEqual([36, true]);
await expect(
deltaProvider.getTimeout(
'BTC/BTC',
OrderSide.SELL,
SwapType.Submarine,
SwapVersion.Taproot,
),
).resolves.toEqual([1008, true]);

// Should throw if pair cannot be found
const notFound = 'notFound';

Expand Down

0 comments on commit a47bd78

Please sign in to comment.