Skip to content

Commit a2604f7

Browse files
committed
f Document assumptions to require 1 UTXO per channel
1 parent a9ca975 commit a2604f7

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
@@ -199,13 +199,24 @@ fn get_reserve_per_channel_with_input(
199199

200200
/// Returns the amount that needs to be maintained as a reserve per anchor channel.
201201
///
202-
/// This reserve currently needs to be allocated as a disjoint set of UTXOs per channel,
202+
/// This reserve currently needs to be allocated as a disjoint set of at least 1 UTXO per channel,
203203
/// as claims are not yet aggregated across channels.
204204
///
205-
/// Note that the returned amount assumes that the reserve will be provided by a single UTXO of the
206-
/// type indicated by [AnchorChannelReserveContext::taproot_wallet]. Larger sets of UTXOs with more
207-
/// complex witnesses will require a correspondingly larger reserve due to the weight required to
208-
/// spend them.
205+
/// To only require 1 UTXO per channel, it is assumed that, on average, transactions are able to
206+
/// get confirmed within 1 block with [ConfirmationTarget::UrgentOnChainSweep], or that only a
207+
/// portion of channels will go through unilateral closure at the same time, allowing UTXOs to be
208+
/// shared. Otherwise, multiple UTXOs would be needed per channel:
209+
/// - HTLC time-out transactions with different expiries cannot be aggregated. This could result in
210+
/// many individual transactions that need to be confirmed starting from different, but potentially
211+
/// sequential block heights.
212+
/// - If each transaction takes N blocks to confirm, at least N UTXOs are needed to provide the
213+
/// necessary concurrency.
214+
///
215+
/// The returned amount includes the fee to spend a single UTXO of the type indicated by
216+
/// [AnchorChannelReserveContext::taproot_wallet]. Larger sets of UTXOs with more complex witnesses
217+
/// will need to include the corresponding fee required to spend them.
218+
///
219+
/// [ConfirmationTarget::UrgentOnChainSweep]: crate::chain::chaininterface::ConfirmationTarget::UrgentOnChainSweep
209220
pub fn get_reserve_per_channel(
210221
context: &AnchorChannelReserveContext,
211222
) -> Result<Amount, AnchorChannelReserveError> {

0 commit comments

Comments
 (0)