Skip to content

Commit cc232a8

Browse files
committed
Allow HTLC receiver to dip into channel reserve
When an HTLC is added, the size of the commitment transaction increases while that HTLC is pending, which also increases the on-chain fee that the channel initiator must deduce from its main output. Before sending an HTLC, when we're not the channel initiator, we thus must ensure that our peer has enough balance to pay for the increased commitment transaction fee. We previously went further than that, and also required that our peer stayed above their channel reserve. That additional requirement was unnecessary, and there was no matching receiver-side requirement, so it should be safe to delete. It makes a lot of sense to allow the HTLC receiver to dip into its channel reserve to pay the fee for an HTLC they're receiving, because this HTLC will either: - be failed, in which case the balance goes back above channel reserve - be fulfilled, in which case the balance increases which also helps meet the channel reserve This also prevents channels from being stuck if the reserve becomes dynamic (which will be the case with splicing). Without that change, we can end up in a situation where most of the channel funds are on the non-initiator side, but they cannot send HTLCs because that would make the initiator dip into their reserve to pay the increased fee. Since this effectively shrinks the channel initiator's reserve, the sender must ensure that the resulting reserve is still large enough to incentivize the initiator to behave honestly (for example by allowing only X% of the channel reserve to be used for fees).
1 parent aad959a commit cc232a8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

02-peer-protocol.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,11 @@ A sending node:
10151015
buffer" can handle twice the current `feerate_per_kw` to ensure predictability
10161016
between implementations.
10171017
- if it is _not responsible_ for paying the Bitcoin fee:
1018-
- SHOULD NOT offer `amount_msat` if, once the remote node adds that HTLC to
1019-
its commitment transaction, it cannot pay the fee for the updated local or
1020-
remote transaction at the current `feerate_per_kw` while maintaining its
1021-
channel reserve.
1018+
- MAY offer `amount_msat` where, once the remote node adds that HTLC to its
1019+
commitment transaction, it goes below its channel reserve to pay the fee for
1020+
the updated local or remote transaction at the current `feerate_per_kw`. The
1021+
sending node should limit how much of the channel reserve can be used to pay
1022+
the fee to ensure that the receiving node always has some funds at stake.
10221023
- MUST offer `amount_msat` greater than 0.
10231024
- MUST NOT offer `amount_msat` below the receiving node's `htlc_minimum_msat`
10241025
- MUST set `cltv_expiry` less than 500000000.
@@ -1094,6 +1095,14 @@ maintaining its channel reserve (because of the increased weight of the
10941095
commitment transaction), resulting in a degraded channel. See [#728](https://github.com/lightningnetwork/lightning-rfc/issues/728)
10951096
for more details.
10961097

1098+
When the node _responsible_ for paying the Bitcoin fee is below or just
1099+
slightly above its channel reserve, the other node may allow it to dip
1100+
into the channel reserve to pay the fee for an incoming HTLC. This is
1101+
effectively the same as temporarily shrinking the channel reserve. The
1102+
node _not responsible_ for paying the Bitcoin fee must ensure that the
1103+
effective channel reserve is still large enough to incentivize the other
1104+
node to behave honestly.
1105+
10971106
### Removing an HTLC: `update_fulfill_htlc`, `update_fail_htlc`, and `update_fail_malformed_htlc`
10981107

10991108
For simplicity, a node can only remove HTLCs added by the other node.

0 commit comments

Comments
 (0)