Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the lsps2 cltv delta check #170

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ jobs:
testLsps2GetInfo,
testLsps2Buy,
testLsps2HappyFlow,
testLsps2Cltv,
testLsps2NoBalance,
testLsps2ZeroConfUtxo
]
Expand Down
5 changes: 0 additions & 5 deletions itest/lspd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ var allTestCases = []*testCase{
test: testLsps2HappyFlow,
isLsps2: true,
},
{
name: "testLsps2Cltv",
test: testLsps2Cltv,
isLsps2: true,
},
{
name: "testLsps2NoBalance",
test: testLsps2NoBalance,
Expand Down
66 changes: 0 additions & 66 deletions itest/lsps2_cltv_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions lsps2/intercept_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ func (i *Interceptor) processPart(payment *paymentState, part *partState) {
}
}

// Make sure the cltv delta is enough (actual cltv delta + 2).
// Make sure the cltv delta is enough.
if int64(part.req.IncomingExpiry)-int64(part.req.OutgoingExpiry) <
int64(i.config.TimeLockDelta)+2 {
int64(i.config.TimeLockDelta) {
i.failPart(payment, part, common.FAILURE_INCORRECT_CLTV_EXPIRY)
return
}
Expand Down
8 changes: 4 additions & 4 deletions lsps2/intercept_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,13 +314,13 @@ func Test_NoMpp_AmtAboveMaximum(t *testing.T) {
}

// Asserts that a no-MPP+var-invoice mode payment fails when the cltv delta is
// less than cltv delta + 2.
// less than cltv delta.
func Test_NoMpp_CltvDeltaBelowMinimum(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
i := setupInterceptor(ctx, nil)

res := i.Intercept(createPart(&part{cltvDelta: 145}))
res := i.Intercept(createPart(&part{cltvDelta: 143}))
assert.Equal(t, common.INTERCEPT_FAIL_HTLC_WITH_CODE, res.Action)
assert.Equal(t, common.FAILURE_INCORRECT_CLTV_EXPIRY, res.FailureCode)
assertEmpty(t, i)
Expand Down Expand Up @@ -533,13 +533,13 @@ func Test_Mpp_BadSecondPart_ThirdPartCompletes(t *testing.T) {
}

// Asserts that a MPP+fixed-invoice mode payment fails when the cltv delta is
// less than cltv delta + 2.
// less than cltv delta.
func Test_Mpp_CltvDeltaBelowMinimum(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
i := setupInterceptor(ctx, &interceptP{store: mppStore()})

res := i.Intercept(createPart(&part{cltvDelta: 145}))
res := i.Intercept(createPart(&part{cltvDelta: 143}))
assert.Equal(t, common.INTERCEPT_FAIL_HTLC_WITH_CODE, res.Action)
assert.Equal(t, common.FAILURE_INCORRECT_CLTV_EXPIRY, res.FailureCode)
assertEmpty(t, i)
Expand Down
Loading