From a2f0d6d38ec22d80204acbd344eb34b270e23204 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 26 Jun 2018 16:58:12 -0700 Subject: [PATCH] htlcswitch: use the delta within the time lock, not the default policy at exit node In this commit, we fix a lingering bug within the link when we're the exit node for a particular payment. Before this commit, we would assert that the invoice gives us enough of a delta based on our current routing policy. However, if the invoice was generated with a lower delta, or we've changed from the default routing policy, then this would case us to fail back any payments sent to us. We fix this by instead using the newly available final CLTV delta information within the extracted invoice. Fixes #1431. --- htlcswitch/link.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 2aeb9707e..f56d2865e 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -2210,9 +2210,8 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg, // We'll also ensure that our time-lock value has been // computed correctly. - // - // TODO(roasbeef): also accept global default? - expectedHeight := heightNow + l.cfg.FwrdingPolicy.TimeLockDelta + minCltvDelta := uint32(invoice.Terms.FinalCltvDelta) + expectedHeight := heightNow + minCltvDelta switch { case !l.cfg.DebugHTLC && fwdInfo.OutgoingCTLV < expectedHeight: