Fix `REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH` for contest delays >0x7fff
authorMatt Corallo <git@bluematt.me>
Sun, 24 Dec 2023 05:55:11 +0000 (05:55 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 29 Dec 2023 06:24:18 +0000 (06:24 +0000)
commitc946edb218761c8ae7456ca9d89776410801c83a
treedb35e828d3482b6288446a358311482c59246e8d
parentddb54fc2d2f539502ab36357470f8a9a9d9555f1
Fix `REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH` for contest delays >0x7fff

When contest delays are >= 0x8000, script pushes require an extra
byte to avoid being interpreted as a negative int. Thus, for
channels with CSV delays longer than ~7.5 months we may generate
transactions with slightly too little fee. This isn't really a huge
deal, but we should prefer to be conservative here, and slightly
too high fee in the general case is better than slightly too little
fee in other cases.
lightning/src/ln/chan_utils.rs