Be less aggressive in outbound HTLC CLTV timeout checks 2021-10-less-aggressive-htlc-timeouts
authorMatt Corallo <git@bluematt.me>
Wed, 13 Oct 2021 04:19:13 +0000 (04:19 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 16 Nov 2021 15:22:42 +0000 (15:22 +0000)
commit5e998cce6ba4511df483cf893cd19b51a0ac0214
treea7d2c5b5dd015304fca1c935a9c0d94a492fc374
parentfe8c10db95124e3238b7469bdabb00afc7c5bdd6
Be less aggressive in outbound HTLC CLTV timeout checks

We currently assume our counterparty is naive and misconfigured and
may force-close a channel to get an HTLC we just forwarded them.

There shouldn't be any reason to do this - we don't have any such
bug, and we shouldn't start by assuming our counterparties are
buggy. Worse, this results in refusing to forward payments today,
failing HTLCs for largely no reason.

Instead, we keep a fairly conservative check, but not one which
will fail HTLC forwarding spuriously - testing only that the HTLC
doesn't expire for a few blocks from now.

Fixes #1114.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_tests.rs