Correct MIN_FINAL_CLTV_EXPIRY to match our enforced requirements
authorMatt Corallo <git@bluematt.me>
Wed, 5 May 2021 02:17:02 +0000 (02:17 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 5 May 2021 20:09:11 +0000 (20:09 +0000)
commit68c2c4455933ccbb924a9297d85e78eb39576814
tree2697e6a236196bd4cd252b0e21b999854004ce72
parente84f5edbc5b959c7bbad17b5968f2c9e32df68df
Correct MIN_FINAL_CLTV_EXPIRY to match our enforced requirements

Our enforced requirements for HTLC acceptance is that we have at
least HTLC_FAIL_BACK_BUFFER blocks before the HTLC expires. When we
receive an HTLC, the HTLC would be "already expired" if its
`cltv_expiry` is current-block + 1 (ie the next block could
broadcast the commitment transaction and time out the HTLC). From
there, we want an extra HTLC_FAIL_BACK_BUFFER in blocks, plus an
extra block or two to account for any differences in the view of
the current height before send or while the HTLC is transiting the
network.
lightning/src/ln/channelmanager.rs