multi: enforce routing.MinCLTVDelta=18 for invoices + chanupd

This commit clamps all user-chosen CLTVs in LND to be at least 18, which
is the new conservative value used in the sepc. This minimum is applied
uniformly to forwarding CLTV deltas (via channel updates) as well as
final CLTV deltas for new invoices.
This commit is contained in:
Conner Fromknecht
2020-07-24 13:13:56 -07:00
parent 213c51a281
commit 6622c4814e
5 changed files with 47 additions and 18 deletions

View File

@@ -23,7 +23,6 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/record"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/zpay32"
)
var uniquePaymentID uint64 = 1 // to be used atomically
@@ -223,7 +222,7 @@ func TestFindRoutesWithFeeLimit(t *testing.T) {
route, err := ctx.router.FindRoute(
ctx.router.selfNode.PubKeyBytes,
target, paymentAmt, restrictions, nil, nil,
zpay32.DefaultFinalCLTVDelta,
MinCLTVDelta,
)
if err != nil {
t.Fatalf("unable to find any routes: %v", err)
@@ -1284,7 +1283,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
_, err = ctx.router.FindRoute(
ctx.router.selfNode.PubKeyBytes,
targetPubKeyBytes, paymentAmt, noRestrictions, nil, nil,
zpay32.DefaultFinalCLTVDelta,
MinCLTVDelta,
)
if err != nil {
t.Fatalf("unable to find any routes: %v", err)
@@ -1327,7 +1326,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
_, err = ctx.router.FindRoute(
ctx.router.selfNode.PubKeyBytes,
targetPubKeyBytes, paymentAmt, noRestrictions, nil, nil,
zpay32.DefaultFinalCLTVDelta,
MinCLTVDelta,
)
if err != nil {
t.Fatalf("unable to find any routes: %v", err)