Module anchor_channel_reserves

Source
Expand description

Defines anchor channel reserve requirements.

The Lightning protocol advances the state of the channel based on commitment and HTLC transactions, which allow each participant to unilaterally close the channel with the correct state and resolve pending HTLCs on-chain. Originally, these transactions are signed by both counterparties over the entire transaction and therefore contain a fixed fee, which can be updated with the update_fee message by the funder. However, these fees can lead to disagreements and can diverge from the prevailing fee rate if a party is disconnected.

To address these issues, fees are provided exogenously for anchor output channels. Anchor outputs are negotiated on channel opening to add outputs to each commitment transaction. These outputs can be spent in a child transaction with additional fees to incentivize the mining of the parent transaction, this technique is called Child Pays For Parent (CPFP). Similarly, HTLC transactions will be signed with SIGHASH_SINGLE|SIGHASH_ANYONECANPAY so additional inputs and outputs can be added to pay for fees.

UTXO reserves will therefore be required to supply commitment transactions and HTLC transactions with fees to be confirmed in a timely manner. If HTLCs are not resolved appropriately, it can lead to loss of funds of the in-flight HLTCs as mentioned above. Only partially satisfying UTXO requirements incurs the risk of not being able to resolve a subset of HTLCs.

Structs§

AnchorChannelReserveContext
Parameters defining the context around the anchor channel reserve requirement calculation.

Functions§

can_support_additional_anchor_channel
Verifies whether the anchor channel reserve provided by utxos is sufficient to support an additional anchor channel.
get_reserve_per_channel
Returns the amount that needs to be maintained as a reserve per anchor channel.
get_supportable_anchor_channels
Calculates the number of anchor channels that can be supported by the reserve provided by utxos.