Add fee spike buffer + incl commit tx fee in chan reserve calculation
authorValentine Wallace <vwallace@protonmail.com>
Wed, 6 May 2020 23:18:23 +0000 (19:18 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Mon, 15 Jun 2020 19:51:09 +0000 (15:51 -0400)
commitc9926b95001996ec0730667a7f7e90381740fc09
tree55415f5c0d243387592a7ad20a359da0aa3735d5
parent283c94727ff9d291bb188be94891b8427a75096f
Add fee spike buffer + incl commit tx fee in chan reserve calculation

When we receive an inbound HTLC from a peer on an inbound channel,
make sure the funder can still cover the additional on-chain cost
of the HTLC while maintaining their channel reserve.

When we're sending an outbound HTLC, make sure the funder can still
cover the additional on-chain cost of the HTLC while maintaining
their channel reserve.

+ implement fee spike buffer for channel initiators sending payments.
Also add an additional spec-deviating fee spike buffer on the
receiving side (but don't close the channel if this reserve is
violated, just fail the HTLC).
From lightning-rfc PR #740.

Co-authored-by: Matt Corallo <git@bluematt.me>
Co-authored-by: Valentine Wallace <vwallace@protonmail.com>
lightning/src/ln/channel.rs
lightning/src/ln/functional_tests.rs