Skip to content

Commit 2c534bf

Browse files
tankyleoFedeparma74
authored andcommitted
Implement Holder HTLC claim chunking for 0FC channels
Otherwise, we could hit the max 10_000vB size limit on V3 transactions (BIP 431 rule 4). Also introduce a `max_tx_weight` parameter to `select_confirmed_utxos`. This constraint makes sure anchor and HTLC transactions in 0FC channels satisfy the `TRUC_MAX_WEIGHT` and the `TRUC_CHILD_MAX_WEIGHT` maximums. Expand the coin-selection algorithm provided for any `T: WalletSource` to satisfy this new constraint.
1 parent b5087f9 commit 2c534bf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lightning/src/events/bump_transaction/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ pub trait CoinSelectionSource {
390390
/// [`ChannelMonitor::rebroadcast_pending_claims`]: crate::chain::channelmonitor::ChannelMonitor::rebroadcast_pending_claims
391391
fn select_confirmed_utxos<'a>(
392392
&'a self, claim_id: ClaimId, must_spend: Vec<Input>, must_pay_to: &'a [TxOut],
393-
target_feerate_sat_per_1000_weight: u32,
393+
target_feerate_sat_per_1000_weight: u32, max_tx_weight: u64,
394394
) -> AsyncResult<'a, CoinSelection, ()>;
395395
/// Signs and provides the full witness for all inputs within the transaction known to the
396396
/// trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]).
@@ -607,7 +607,7 @@ where
607607
{
608608
fn select_confirmed_utxos<'a>(
609609
&'a self, claim_id: ClaimId, must_spend: Vec<Input>, must_pay_to: &'a [TxOut],
610-
target_feerate_sat_per_1000_weight: u32,
610+
target_feerate_sat_per_1000_weight: u32, max_tx_weight: u64,
611611
) -> AsyncResult<'a, CoinSelection, ()> {
612612
Box::pin(async move {
613613
let utxos = self.source.list_confirmed_utxos().await?;

lightning/src/events/bump_transaction/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ where
170170
{
171171
fn select_confirmed_utxos<'a>(
172172
&'a self, claim_id: ClaimId, must_spend: Vec<Input>, must_pay_to: &'a [TxOut],
173-
target_feerate_sat_per_1000_weight: u32,
173+
target_feerate_sat_per_1000_weight: u32, max_tx_weight: u64,
174174
) -> AsyncResult<'a, CoinSelection, ()> {
175175
let coins = self.0.select_confirmed_utxos(
176176
claim_id,

0 commit comments

Comments
 (0)