Skip to content

Commit 3bc15bd

Browse files
committed
f Document assumptions to require 1 UTXO per channel
1 parent b90a953 commit 3bc15bd

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lightning/src/util/anchor_channel_reserves.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,24 @@ fn get_reserve_per_channel_with_input(
187187

188188
/// Returns the amount that needs to be maintained as a reserve per anchor channel.
189189
///
190-
/// This reserve currently needs to be allocated as a disjoint set of UTXOs per channel,
190+
/// This reserve currently needs to be allocated as a disjoint set of at least 1 UTXO per channel,
191191
/// as claims are not yet aggregated across channels.
192192
///
193-
/// Note that the returned amount assumes that the reserve will be provided by a single UTXO of the
194-
/// type indicated by [AnchorChannelReserveContext::taproot_wallet]. Larger sets of UTXOs with more
195-
/// complex witnesses will require a correspondingly larger reserve due to the weight required to
196-
/// spend them.
193+
/// To only require 1 UTXO per channel, it is assumed that, on average, transactions are able to
194+
/// get confirmed within 1 block with [ConfirmationTarget::UrgentOnChainSweep], or that only a
195+
/// portion of channels will go through unilateral closure at the same time, allowing UTXOs to be
196+
/// shared. Otherwise, multiple UTXOs would be needed per channel:
197+
/// - HTLC time-out transactions with different expiries cannot be aggregated. This could result in
198+
/// many individual transactions that need to be confirmed starting from different, but potentially
199+
/// sequential block heights.
200+
/// - If each transaction takes N blocks to confirm, at least N UTXOs are needed to provide the
201+
/// necessary concurrency.
202+
///
203+
/// The returned amount includes the fee to spend a single UTXO of the type indicated by
204+
/// [AnchorChannelReserveContext::taproot_wallet]. Larger sets of UTXOs with more complex witnesses
205+
/// will need to include the corresponding fee required to spend them.
206+
///
207+
/// [ConfirmationTarget::UrgentOnChainSweep]: crate::chain::chaininterface::ConfirmationTarget::UrgentOnChainSweep
197208
pub fn get_reserve_per_channel(context: &AnchorChannelReserveContext) -> Amount {
198209
get_reserve_per_channel_with_input(
199210
context,

0 commit comments

Comments
 (0)