From aee1619488d06113292bd159cf490a938eb00011 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 18 Oct 2017 22:00:03 -0700 Subject: [PATCH] routing: add new FinalCLTVDelta attribute to SendPayment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this commit, we’ll now optionally allow the user to pass in the CLTV delta value specified by the recipient a payment. If the value isn’t specified, then we’ll use the current global default for the payment. --- routing/router.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/routing/router.go b/routing/router.go index 1b98b2a5..16dafb25 100644 --- a/routing/router.go +++ b/routing/router.go @@ -1164,6 +1164,13 @@ type LightningPayment struct { // the first hop. PaymentHash [32]byte + // FinalCLTVDelta is the CTLV expiry delta to use for the _final_ hop + // in the route. This means that the final hop will have a CLTV delta + // of at least: currentHeight + FinalCLTVDelta. If this value is + // unspcified, then a default value of DefaultFinalCLTVDelta will be + // used. + FinalCLTVDelta *uint16 + // TODO(roasbeef): add e2e message? } @@ -1194,6 +1201,13 @@ func (r *ChannelRouter) SendPayment(payment *LightningPayment) ([32]byte, *Route return preImage, nil, err } + var finalCLTVDelta uint16 + if payment.FinalCLTVDelta == nil { + finalCLTVDelta = DefaultFinalCLTVDelta + } else { + finalCLTVDelta = *payment.FinalCLTVDelta + } + // We'll continue until either our payment succeeds, or we encounter a // critical error during path finding. for {