Skip to content

Commit fbd6403

Browse files
committed
fix: higher invoice CLTV offset for Reverse Swaps
1 parent a16e258 commit fbd6403

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/service/Service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,9 +1188,9 @@ class Service {
11881188
onchainTimeoutBlockDelta,
11891189
);
11901190

1191-
// Add 3 blocks to the delta for same currency swaps and 25% for cross chain ones as buffer
1191+
// Add 15 blocks to the delta for same currency swaps and 25% for cross chain ones as buffer
11921192
lightningTimeoutBlockDelta +=
1193-
sending === receiving ? 3 : Math.ceil(lightningTimeoutBlockDelta * 0.25);
1193+
sending === receiving ? 15 : Math.ceil(lightningTimeoutBlockDelta * 0.25);
11941194

11951195
const rate = getRate(pairRate, side, true);
11961196
const feePercent = this.rateProvider.feeProvider.getPercentageFee(

test/unit/service/Service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ describe('Service', () => {
15091509
quoteCurrency: 'BTC',
15101510
orderSide: OrderSide.BUY,
15111511
onchainTimeoutBlockDelta: 1,
1512-
lightningTimeoutBlockDelta: 4,
1512+
lightningTimeoutBlockDelta: 16,
15131513
holdInvoiceAmount: invoiceAmount,
15141514
percentageFee: invoiceAmount * mockGetPercentageFeeResult,
15151515
});
@@ -1669,7 +1669,7 @@ describe('Service', () => {
16691669
quoteCurrency: 'BTC',
16701670
orderSide: OrderSide.BUY,
16711671
onchainTimeoutBlockDelta: 1,
1672-
lightningTimeoutBlockDelta: 4,
1672+
lightningTimeoutBlockDelta: 16,
16731673
holdInvoiceAmount: invoiceAmount,
16741674
percentageFee: invoiceAmount * mockGetPercentageFeeResult,
16751675
});
@@ -1748,7 +1748,7 @@ describe('Service', () => {
17481748
quoteCurrency: 'BTC',
17491749
orderSide: OrderSide.BUY,
17501750
onchainTimeoutBlockDelta: 1,
1751-
lightningTimeoutBlockDelta: 4,
1751+
lightningTimeoutBlockDelta: 16,
17521752
prepayMinerFeeInvoiceAmount: mockGetBaseFeeResult,
17531753
holdInvoiceAmount: invoiceAmount - mockGetBaseFeeResult,
17541754
percentageFee: invoiceAmount * mockGetPercentageFeeResult,

0 commit comments

Comments
 (0)