Skip to content

Commit 3dcf40a

Browse files
committed
Relax the requirements of building a CommitmentTransaction
Building `CommitmentTransaction` previously required a pointer to a `Vec<(HTLCOutputInCommitment, T)>`, where each item in the vector represented a non-dust htlc. This forced the caller to place all the non-dust htlcs and their auxiliary data in contiguous memory prior to building a `CommitmentTransaction`. This requirement was not necessary, so we remove it in this commit. Instead, we choose to ask for an iterator that yields exclusive references to the non-dust HTLCs, so that `CommitmentTranscation` may populate their output indices during the build process. We decided against asking explicitly for a `Vec<&mut HTLCOutputInCommitment>` to avoid requiring an extra memory allocation.
1 parent ca8c728 commit 3dcf40a

File tree

5 files changed

+64
-66
lines changed

5 files changed

+64
-66
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,21 +3454,21 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
34543454
// information to rebuild it
34553455
if let Some((their_per_commitment_point, feerate_per_kw, to_broadcaster_value,
34563456
to_countersignatory_value)) = self.initial_counterparty_commitment_info {
3457-
let htlc_outputs = vec![];
3457+
let mut htlc_outputs = Vec::new();
34583458

34593459
let commitment_tx = self.build_counterparty_commitment_tx(INITIAL_COMMITMENT_NUMBER,
34603460
&their_per_commitment_point, to_broadcaster_value, to_countersignatory_value,
3461-
feerate_per_kw, htlc_outputs);
3461+
feerate_per_kw, htlc_outputs.iter_mut());
34623462
Some(commitment_tx)
34633463
} else {
34643464
self.initial_counterparty_commitment_tx.clone()
34653465
}
34663466
}
34673467

3468-
fn build_counterparty_commitment_tx(
3468+
fn build_counterparty_commitment_tx<'a>(
34693469
&self, commitment_number: u64, their_per_commitment_point: &PublicKey,
34703470
to_broadcaster_value: u64, to_countersignatory_value: u64, feerate_per_kw: u32,
3471-
mut nondust_htlcs: Vec<(HTLCOutputInCommitment, Option<Box<HTLCSource>>)>
3471+
nondust_htlcs: impl Iterator<Item = &'a mut HTLCOutputInCommitment>,
34723472
) -> CommitmentTransaction {
34733473
let broadcaster_keys = &self.onchain_tx_handler.channel_transaction_parameters
34743474
.counterparty_parameters.as_ref().unwrap().pubkeys;
@@ -3482,9 +3482,9 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
34823482
let channel_parameters =
34833483
&self.onchain_tx_handler.channel_transaction_parameters.as_counterparty_broadcastable();
34843484

3485-
CommitmentTransaction::new_with_auxiliary_htlc_data(commitment_number,
3485+
CommitmentTransaction::new(commitment_number,
34863486
to_broadcaster_value, to_countersignatory_value, broadcaster_funding_key,
3487-
countersignatory_funding_key, keys, feerate_per_kw, &mut nondust_htlcs,
3487+
countersignatory_funding_key, keys, feerate_per_kw, nondust_htlcs,
34883488
channel_parameters)
34893489
}
34903490

@@ -3499,13 +3499,13 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
34993499
to_countersignatory_value_sat: Some(to_countersignatory_value),
35003500
commitment_tx: None } => {
35013501

3502-
let nondust_htlcs = htlc_outputs.iter().filter_map(|(htlc, _)| {
3503-
htlc.transaction_output_index.map(|_| (htlc.clone(), None))
3504-
}).collect::<Vec<_>>();
3502+
let mut nondust_htlcs = htlc_outputs.iter().filter_map(|(htlc, _)| {
3503+
htlc.transaction_output_index.map(|_| htlc)
3504+
}).cloned().collect::<Vec<_>>();
35053505

35063506
let commitment_tx = self.build_counterparty_commitment_tx(commitment_number,
35073507
&their_per_commitment_point, to_broadcaster_value,
3508-
to_countersignatory_value, feerate_per_kw, nondust_htlcs);
3508+
to_countersignatory_value, feerate_per_kw, nondust_htlcs.iter_mut());
35093509

35103510
debug_assert_eq!(commitment_tx.trust().txid(), commitment_txid);
35113511

@@ -5387,21 +5387,21 @@ mod tests {
53875387
{
53885388
let mut res = Vec::new();
53895389
for (idx, preimage) in $preimages_slice.iter().enumerate() {
5390-
res.push((HTLCOutputInCommitment {
5390+
res.push(HTLCOutputInCommitment {
53915391
offered: true,
53925392
amount_msat: 0,
53935393
cltv_expiry: 0,
53945394
payment_hash: preimage.1.clone(),
53955395
transaction_output_index: Some(idx as u32),
5396-
}, ()));
5396+
});
53975397
}
53985398
res
53995399
}
54005400
}
54015401
}
54025402
macro_rules! preimages_slice_to_htlc_outputs {
54035403
($preimages_slice: expr) => {
5404-
preimages_slice_to_htlcs!($preimages_slice).into_iter().map(|(htlc, _)| (htlc, None)).collect()
5404+
preimages_slice_to_htlcs!($preimages_slice).into_iter().map(|htlc| (htlc, None)).collect()
54055405
}
54065406
}
54075407
let dummy_sig = crate::crypto::utils::sign(&secp_ctx,
@@ -5463,7 +5463,7 @@ mod tests {
54635463
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(&mut htlcs);
54645464

54655465
monitor.provide_latest_holder_commitment_tx(dummy_commitment_tx.clone(),
5466-
htlcs.into_iter().map(|(htlc, _)| (htlc, Some(dummy_sig), None)).collect()).unwrap();
5466+
htlcs.into_iter().map(|htlc| (htlc, Some(dummy_sig), None)).collect()).unwrap();
54675467
monitor.provide_latest_counterparty_commitment_tx(Txid::from_byte_array(Sha256::hash(b"1").to_byte_array()),
54685468
preimages_slice_to_htlc_outputs!(preimages[5..15]), 281474976710655, dummy_key, &logger);
54695469
monitor.provide_latest_counterparty_commitment_tx(Txid::from_byte_array(Sha256::hash(b"2").to_byte_array()),
@@ -5501,7 +5501,7 @@ mod tests {
55015501
let mut htlcs = preimages_slice_to_htlcs!(preimages[0..5]);
55025502
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(&mut htlcs);
55035503
monitor.provide_latest_holder_commitment_tx(dummy_commitment_tx.clone(),
5504-
htlcs.into_iter().map(|(htlc, _)| (htlc, Some(dummy_sig), None)).collect()).unwrap();
5504+
htlcs.into_iter().map(|htlc| (htlc, Some(dummy_sig), None)).collect()).unwrap();
55055505
secret[0..32].clone_from_slice(&<Vec<u8>>::from_hex("2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8").unwrap());
55065506
monitor.provide_secret(281474976710653, secret.clone()).unwrap();
55075507
assert_eq!(monitor.inner.lock().unwrap().payment_preimages.len(), 12);
@@ -5512,7 +5512,7 @@ mod tests {
55125512
let mut htlcs = preimages_slice_to_htlcs!(preimages[0..3]);
55135513
let dummy_commitment_tx = HolderCommitmentTransaction::dummy(&mut htlcs);
55145514
monitor.provide_latest_holder_commitment_tx(dummy_commitment_tx,
5515-
htlcs.into_iter().map(|(htlc, _)| (htlc, Some(dummy_sig), None)).collect()).unwrap();
5515+
htlcs.into_iter().map(|htlc| (htlc, Some(dummy_sig), None)).collect()).unwrap();
55165516
secret[0..32].clone_from_slice(&<Vec<u8>>::from_hex("27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116").unwrap());
55175517
monitor.provide_secret(281474976710652, secret.clone()).unwrap();
55185518
assert_eq!(monitor.inner.lock().unwrap().payment_preimages.len(), 5);

lightning/src/chain/onchaintx.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,16 +1363,15 @@ mod tests {
13631363
for i in 0..3 {
13641364
let preimage = PaymentPreimage([i; 32]);
13651365
let hash = PaymentHash(Sha256::hash(&preimage.0[..]).to_byte_array());
1366-
htlcs.push((
1366+
htlcs.push(
13671367
HTLCOutputInCommitment {
13681368
offered: true,
13691369
amount_msat: 10000,
13701370
cltv_expiry: i as u32,
13711371
payment_hash: hash,
13721372
transaction_output_index: Some(i as u32),
13731373
},
1374-
(),
1375-
));
1374+
);
13761375
}
13771376
let holder_commit = HolderCommitmentTransaction::dummy(&mut htlcs);
13781377
let mut tx_handler = OnchainTxHandler::new(
@@ -1400,7 +1399,7 @@ mod tests {
14001399
// Request claiming of each HTLC on the holder's commitment, with current block height 1.
14011400
let holder_commit_txid = tx_handler.get_unsigned_holder_commitment_tx().compute_txid();
14021401
let mut requests = Vec::new();
1403-
for (htlc, _) in htlcs {
1402+
for htlc in htlcs {
14041403
requests.push(PackageTemplate::build_package(
14051404
holder_commit_txid,
14061405
htlc.transaction_output_index.unwrap(),

lightning/src/ln/chan_utils.rs

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ impl_writeable_tlv_based!(HolderCommitmentTransaction, {
11051105

11061106
impl HolderCommitmentTransaction {
11071107
#[cfg(test)]
1108-
pub fn dummy(htlcs: &mut Vec<(HTLCOutputInCommitment, ())>) -> Self {
1108+
pub fn dummy(nondust_htlcs: &mut Vec<HTLCOutputInCommitment>) -> Self {
11091109
let secp_ctx = Secp256k1::new();
11101110
let dummy_key = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
11111111
let dummy_sig = sign(&secp_ctx, &secp256k1::Message::from_digest([42; 32]), &SecretKey::from_slice(&[42; 32]).unwrap());
@@ -1133,11 +1133,11 @@ impl HolderCommitmentTransaction {
11331133
channel_type_features: ChannelTypeFeatures::only_static_remote_key(),
11341134
};
11351135
let mut counterparty_htlc_sigs = Vec::new();
1136-
for _ in 0..htlcs.len() {
1136+
for _ in 0..nondust_htlcs.len() {
11371137
counterparty_htlc_sigs.push(dummy_sig);
11381138
}
1139-
let inner = CommitmentTransaction::new_with_auxiliary_htlc_data(0, 0, 0, dummy_key.clone(), dummy_key.clone(), keys, 0, htlcs, &channel_parameters.as_counterparty_broadcastable());
1140-
htlcs.sort_by_key(|htlc| htlc.0.transaction_output_index);
1139+
let inner = CommitmentTransaction::new(0, 0, 0, dummy_key.clone(), dummy_key.clone(), keys, 0, nondust_htlcs.iter_mut(), &channel_parameters.as_counterparty_broadcastable());
1140+
nondust_htlcs.sort_by_key(|htlc| htlc.transaction_output_index);
11411141
HolderCommitmentTransaction {
11421142
inner,
11431143
counterparty_sig: dummy_sig,
@@ -1440,18 +1440,15 @@ impl CommitmentTransaction {
14401440
///
14411441
/// Populates HTLCOutputInCommitment.transaction_output_index in htlcs_with_aux.
14421442
///
1443-
/// The generic T allows the caller to match the HTLC output index with auxiliary data.
1444-
/// This auxiliary data is not stored in this object.
1445-
///
14461443
/// Only include HTLCs that are above the dust limit for the channel.
14471444
///
14481445
/// This is not exported to bindings users due to the generic though we likely should expose a version without
1449-
pub fn new_with_auxiliary_htlc_data<T>(commitment_number: u64, to_broadcaster_value_sat: u64, to_countersignatory_value_sat: u64, broadcaster_funding_key: PublicKey, countersignatory_funding_key: PublicKey, keys: TxCreationKeys, feerate_per_kw: u32, htlcs_with_aux: &mut Vec<(HTLCOutputInCommitment, T)>, channel_parameters: &DirectedChannelTransactionParameters) -> CommitmentTransaction {
1446+
pub fn new<'a>(commitment_number: u64, to_broadcaster_value_sat: u64, to_countersignatory_value_sat: u64, broadcaster_funding_key: PublicKey, countersignatory_funding_key: PublicKey, keys: TxCreationKeys, feerate_per_kw: u32, nondust_htlcs: impl Iterator<Item = &'a mut HTLCOutputInCommitment>, channel_parameters: &DirectedChannelTransactionParameters) -> CommitmentTransaction {
14501447
let to_broadcaster_value_sat = Amount::from_sat(to_broadcaster_value_sat);
14511448
let to_countersignatory_value_sat = Amount::from_sat(to_countersignatory_value_sat);
14521449

14531450
// Sort outputs and populate output indices while keeping track of the auxiliary data
1454-
let (outputs, htlcs) = Self::internal_build_outputs(&keys, to_broadcaster_value_sat, to_countersignatory_value_sat, htlcs_with_aux, channel_parameters, &broadcaster_funding_key, &countersignatory_funding_key).unwrap();
1451+
let (outputs, nondust_htlcs) = Self::internal_build_outputs(&keys, to_broadcaster_value_sat, to_countersignatory_value_sat, nondust_htlcs, channel_parameters, &broadcaster_funding_key, &countersignatory_funding_key).unwrap();
14551452

14561453
let (obscured_commitment_transaction_number, txins) = Self::internal_build_inputs(commitment_number, channel_parameters);
14571454
let transaction = Self::make_transaction(obscured_commitment_transaction_number, txins, outputs);
@@ -1462,7 +1459,7 @@ impl CommitmentTransaction {
14621459
to_countersignatory_value_sat,
14631460
to_broadcaster_delay: Some(channel_parameters.contest_delay()),
14641461
feerate_per_kw,
1465-
htlcs,
1462+
htlcs: nondust_htlcs,
14661463
channel_type_features: channel_parameters.channel_type_features().clone(),
14671464
keys,
14681465
built: BuiltCommitmentTransaction {
@@ -1483,8 +1480,8 @@ impl CommitmentTransaction {
14831480
fn internal_rebuild_transaction(&self, keys: &TxCreationKeys, channel_parameters: &DirectedChannelTransactionParameters, broadcaster_funding_key: &PublicKey, countersignatory_funding_key: &PublicKey) -> Result<BuiltCommitmentTransaction, ()> {
14841481
let (obscured_commitment_transaction_number, txins) = Self::internal_build_inputs(self.commitment_number, channel_parameters);
14851482

1486-
let mut htlcs_with_aux = self.htlcs.iter().map(|h| (h.clone(), ())).collect();
1487-
let (outputs, _) = Self::internal_build_outputs(keys, self.to_broadcaster_value_sat, self.to_countersignatory_value_sat, &mut htlcs_with_aux, channel_parameters, broadcaster_funding_key, countersignatory_funding_key)?;
1483+
let mut nondust_htlcs = self.htlcs.clone();
1484+
let (outputs, _) = Self::internal_build_outputs(keys, self.to_broadcaster_value_sat, self.to_countersignatory_value_sat, nondust_htlcs.iter_mut(), channel_parameters, broadcaster_funding_key, countersignatory_funding_key)?;
14881485

14891486
let transaction = Self::make_transaction(obscured_commitment_transaction_number, txins, outputs);
14901487
let txid = transaction.compute_txid();
@@ -1508,12 +1505,24 @@ impl CommitmentTransaction {
15081505
// - initial sorting of outputs / HTLCs in the constructor, in which case T is auxiliary data the
15091506
// caller needs to have sorted together with the HTLCs so it can keep track of the output index
15101507
// - building of a bitcoin transaction during a verify() call, in which case T is just ()
1511-
fn internal_build_outputs<T>(keys: &TxCreationKeys, to_broadcaster_value_sat: Amount, to_countersignatory_value_sat: Amount, htlcs_with_aux: &mut Vec<(HTLCOutputInCommitment, T)>, channel_parameters: &DirectedChannelTransactionParameters, broadcaster_funding_key: &PublicKey, countersignatory_funding_key: &PublicKey) -> Result<(Vec<TxOut>, Vec<HTLCOutputInCommitment>), ()> {
1508+
fn internal_build_outputs<'a>(keys: &TxCreationKeys, to_broadcaster_value_sat: Amount, to_countersignatory_value_sat: Amount, nondust_htlcs: impl Iterator<Item = &'a mut HTLCOutputInCommitment>, channel_parameters: &DirectedChannelTransactionParameters, broadcaster_funding_key: &PublicKey, countersignatory_funding_key: &PublicKey) -> Result<(Vec<TxOut>, Vec<HTLCOutputInCommitment>), ()> {
15121509
let countersignatory_pubkeys = channel_parameters.countersignatory_pubkeys();
15131510
let contest_delay = channel_parameters.contest_delay();
15141511

15151512
let mut txouts: Vec<(TxOut, Option<&mut HTLCOutputInCommitment>)> = Vec::new();
15161513

1514+
for htlc in nondust_htlcs {
1515+
let script = get_htlc_redeemscript(&htlc, &channel_parameters.channel_type_features(), &keys);
1516+
let txout = TxOut {
1517+
script_pubkey: script.to_p2wsh(),
1518+
value: htlc.to_bitcoin_amount(),
1519+
};
1520+
txouts.push((txout, Some(htlc)));
1521+
}
1522+
// This removes the need for the `ExactSizeIterator` bound on `nondust_htlcs`
1523+
let mut htlcs = Vec::with_capacity(txouts.len());
1524+
let htlcs_empty = txouts.is_empty();
1525+
15171526
if to_countersignatory_value_sat > Amount::ZERO {
15181527
let script = if channel_parameters.channel_type_features().supports_anchors_zero_fee_htlc_tx() {
15191528
get_to_countersignatory_with_anchors_redeemscript(&countersignatory_pubkeys.payment_point).to_p2wsh()
@@ -1545,7 +1554,7 @@ impl CommitmentTransaction {
15451554
}
15461555

15471556
if channel_parameters.channel_type_features().supports_anchors_zero_fee_htlc_tx() {
1548-
if to_broadcaster_value_sat > Amount::ZERO || !htlcs_with_aux.is_empty() {
1557+
if to_broadcaster_value_sat > Amount::ZERO || !htlcs_empty {
15491558
let anchor_script = get_anchor_redeemscript(broadcaster_funding_key);
15501559
txouts.push((
15511560
TxOut {
@@ -1556,7 +1565,7 @@ impl CommitmentTransaction {
15561565
));
15571566
}
15581567

1559-
if to_countersignatory_value_sat > Amount::ZERO || !htlcs_with_aux.is_empty() {
1568+
if to_countersignatory_value_sat > Amount::ZERO || !htlcs_empty {
15601569
let anchor_script = get_anchor_redeemscript(countersignatory_funding_key);
15611570
txouts.push((
15621571
TxOut {
@@ -1568,16 +1577,6 @@ impl CommitmentTransaction {
15681577
}
15691578
}
15701579

1571-
let mut htlcs = Vec::with_capacity(htlcs_with_aux.len());
1572-
for (htlc, _) in htlcs_with_aux {
1573-
let script = get_htlc_redeemscript(&htlc, &channel_parameters.channel_type_features(), &keys);
1574-
let txout = TxOut {
1575-
script_pubkey: script.to_p2wsh(),
1576-
value: htlc.to_bitcoin_amount(),
1577-
};
1578-
txouts.push((txout, Some(htlc)));
1579-
}
1580-
15811580
// Sort output in BIP-69 order (amount, scriptPubkey). Tie-breaks based on HTLC
15821581
// CLTV expiration height.
15831582
sort_outputs(&mut txouts, |a, b| {
@@ -1915,7 +1914,7 @@ mod tests {
19151914
counterparty_funding_pubkey: PublicKey,
19161915
keys: TxCreationKeys,
19171916
feerate_per_kw: u32,
1918-
htlcs_with_aux: Vec<(HTLCOutputInCommitment, ())>,
1917+
nondust_htlcs: Vec<HTLCOutputInCommitment>,
19191918
channel_parameters: ChannelTransactionParameters,
19201919
counterparty_pubkeys: ChannelPublicKeys,
19211920
}
@@ -1943,27 +1942,27 @@ mod tests {
19431942
funding_outpoint: Some(chain::transaction::OutPoint { txid: Txid::all_zeros(), index: 0 }),
19441943
channel_type_features: ChannelTypeFeatures::only_static_remote_key(),
19451944
};
1946-
let htlcs_with_aux = Vec::new();
1945+
let nondust_htlcs = Vec::new();
19471946

19481947
Self {
19491948
commitment_number: 0,
19501949
holder_funding_pubkey: holder_pubkeys.funding_pubkey,
19511950
counterparty_funding_pubkey: counterparty_pubkeys.funding_pubkey,
19521951
keys,
19531952
feerate_per_kw: 1,
1954-
htlcs_with_aux,
1953+
nondust_htlcs,
19551954
channel_parameters,
19561955
counterparty_pubkeys,
19571956
}
19581957
}
19591958

19601959
fn build(&mut self, to_broadcaster_sats: u64, to_countersignatory_sats: u64) -> CommitmentTransaction {
1961-
CommitmentTransaction::new_with_auxiliary_htlc_data(
1960+
CommitmentTransaction::new(
19621961
self.commitment_number, to_broadcaster_sats, to_countersignatory_sats,
19631962
self.holder_funding_pubkey.clone(),
19641963
self.counterparty_funding_pubkey.clone(),
19651964
self.keys.clone(), self.feerate_per_kw,
1966-
&mut self.htlcs_with_aux, &self.channel_parameters.as_holder_broadcastable()
1965+
self.nondust_htlcs.iter_mut(), &self.channel_parameters.as_holder_broadcastable()
19671966
)
19681967
}
19691968
}
@@ -2009,7 +2008,7 @@ mod tests {
20092008

20102009
// Generate broadcaster output and received and offered HTLC outputs, w/o anchors
20112010
builder.channel_parameters.channel_type_features = ChannelTypeFeatures::only_static_remote_key();
2012-
builder.htlcs_with_aux = vec![(received_htlc.clone(), ()), (offered_htlc.clone(), ())];
2011+
builder.nondust_htlcs = vec![received_htlc.clone(), offered_htlc.clone()];
20132012
let tx = builder.build(3000, 0);
20142013
let keys = &builder.keys.clone();
20152014
assert_eq!(tx.built.transaction.output.len(), 3);
@@ -2022,7 +2021,7 @@ mod tests {
20222021

20232022
// Generate broadcaster output and received and offered HTLC outputs, with anchors
20242023
builder.channel_parameters.channel_type_features = ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies();
2025-
builder.htlcs_with_aux = vec![(received_htlc.clone(), ()), (offered_htlc.clone(), ())];
2024+
builder.nondust_htlcs = vec![received_htlc.clone(), offered_htlc.clone()];
20262025
let tx = builder.build(3000, 0);
20272026
assert_eq!(tx.built.transaction.output.len(), 5);
20282027
assert_eq!(tx.built.transaction.output[2].script_pubkey, get_htlc_redeemscript(&received_htlc, &ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies(), &keys).to_p2wsh());

lightning/src/ln/channel.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,15 +3618,15 @@ impl<SP: Deref> ChannelContext<SP> where SP::Target: SignerProvider {
36183618
let channel_parameters =
36193619
if local { self.channel_transaction_parameters.as_holder_broadcastable() }
36203620
else { self.channel_transaction_parameters.as_counterparty_broadcastable() };
3621-
let tx = CommitmentTransaction::new_with_auxiliary_htlc_data(commitment_number,
3622-
value_to_a as u64,
3623-
value_to_b as u64,
3624-
funding_pubkey_a,
3625-
funding_pubkey_b,
3626-
keys.clone(),
3627-
feerate_per_kw,
3628-
&mut included_non_dust_htlcs,
3629-
&channel_parameters
3621+
let tx = CommitmentTransaction::new(commitment_number,
3622+
value_to_a as u64,
3623+
value_to_b as u64,
3624+
funding_pubkey_a,
3625+
funding_pubkey_b,
3626+
keys.clone(),
3627+
feerate_per_kw,
3628+
included_non_dust_htlcs.iter_mut().map(|(htlc, _)| htlc),
3629+
&channel_parameters
36303630
);
36313631
let mut htlcs_included = included_non_dust_htlcs;
36323632
// The unwrap is safe, because all non-dust HTLCs have been assigned an output index

0 commit comments

Comments
 (0)