Skip to content

Commit 9051884

Browse files
author
Antoine Riard
committed
Remove aggregable flag from PackageTemplate constructor
1 parent 597bf03 commit 9051884

File tree

3 files changed

+84
-94
lines changed

3 files changed

+84
-94
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,7 +2422,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
24222422
let commitment_package = PackageTemplate::build_package(
24232423
self.funding_info.0.txid.clone(), self.funding_info.0.index as u32,
24242424
PackageSolvingData::HolderFundingOutput(funding_output),
2425-
best_block_height, false, best_block_height,
2425+
best_block_height, best_block_height
24262426
);
24272427
self.onchain_tx_handler.update_claims_view_from_requests(
24282428
vec![commitment_package], best_block_height, best_block_height,
@@ -2604,9 +2604,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
26042604
for (idx, outp) in tx.output.iter().enumerate() {
26052605
if outp.script_pubkey == revokeable_p2wsh {
26062606
let revk_outp = RevokedOutput::build(per_commitment_point, self.counterparty_commitment_params.counterparty_delayed_payment_base_key, self.counterparty_commitment_params.counterparty_htlc_base_key, per_commitment_key, outp.value, self.counterparty_commitment_params.on_counterparty_tx_csv, self.onchain_tx_handler.opt_anchors(), true);
2607-
// Post-anchor, aggregation of outputs of different types is unsafe. See https://github.com/lightning/bolts/pull/803.
2608-
let aggregation = if self.onchain_tx_handler.opt_anchors() { false } else { true };
2609-
let justice_package = PackageTemplate::build_package(commitment_txid, idx as u32, PackageSolvingData::RevokedOutput(revk_outp), height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, aggregation, height);
2607+
let justice_package = PackageTemplate::build_package(commitment_txid, idx as u32, PackageSolvingData::RevokedOutput(revk_outp), height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, height);
26102608
claimable_outpoints.push(justice_package);
26112609
to_counterparty_output_info =
26122610
Some((idx.try_into().expect("Txn can't have more than 2^32 outputs"), outp.value));
@@ -2624,7 +2622,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
26242622
to_counterparty_output_info);
26252623
}
26262624
let revk_htlc_outp = RevokedHTLCOutput::build(per_commitment_point, self.counterparty_commitment_params.counterparty_delayed_payment_base_key, self.counterparty_commitment_params.counterparty_htlc_base_key, per_commitment_key, htlc.amount_msat / 1000, htlc.clone(), self.onchain_tx_handler.channel_transaction_parameters.opt_anchors.is_some());
2627-
let justice_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, PackageSolvingData::RevokedHTLCOutput(revk_htlc_outp), htlc.cltv_expiry, true, height);
2625+
let justice_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, PackageSolvingData::RevokedHTLCOutput(revk_htlc_outp), htlc.cltv_expiry, height);
26282626
claimable_outpoints.push(justice_package);
26292627
}
26302628
}
@@ -2749,8 +2747,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
27492747
self.counterparty_commitment_params.counterparty_htlc_base_key,
27502748
htlc.clone(), self.onchain_tx_handler.opt_anchors()))
27512749
};
2752-
let aggregation = if !htlc.offered { false } else { true };
2753-
let counterparty_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc.cltv_expiry,aggregation, 0);
2750+
let counterparty_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc.cltv_expiry, 0);
27542751
claimable_outpoints.push(counterparty_package);
27552752
}
27562753
}
@@ -2794,7 +2791,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
27942791
);
27952792
let justice_package = PackageTemplate::build_package(
27962793
htlc_txid, idx as u32, PackageSolvingData::RevokedOutput(revk_outp),
2797-
height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, true, height
2794+
height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, height
27982795
);
27992796
claimable_outpoints.push(justice_package);
28002797
if outputs_to_watch.is_none() {
@@ -2817,11 +2814,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28172814

28182815
for &(ref htlc, _, _) in holder_tx.htlc_outputs.iter() {
28192816
if let Some(transaction_output_index) = htlc.transaction_output_index {
2820-
let (htlc_output, aggregable) = if htlc.offered {
2817+
let htlc_output = if htlc.offered {
28212818
let htlc_output = HolderHTLCOutput::build_offered(
28222819
htlc.amount_msat, htlc.cltv_expiry, self.onchain_tx_handler.opt_anchors()
28232820
);
2824-
(htlc_output, false)
2821+
htlc_output
28252822
} else {
28262823
let payment_preimage = if let Some(preimage) = self.payment_preimages.get(&htlc.payment_hash) {
28272824
preimage.clone()
@@ -2832,12 +2829,12 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28322829
let htlc_output = HolderHTLCOutput::build_accepted(
28332830
payment_preimage, htlc.amount_msat, self.onchain_tx_handler.opt_anchors()
28342831
);
2835-
(htlc_output, self.onchain_tx_handler.opt_anchors())
2832+
htlc_output
28362833
};
28372834
let htlc_package = PackageTemplate::build_package(
28382835
holder_tx.txid, transaction_output_index,
28392836
PackageSolvingData::HolderHTLCOutput(htlc_output),
2840-
htlc.cltv_expiry, aggregable, conf_height
2837+
htlc.cltv_expiry, conf_height
28412838
);
28422839
claim_requests.push(htlc_package);
28432840
}
@@ -3177,7 +3174,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31773174
let should_broadcast = self.should_broadcast_holder_commitment_txn(logger);
31783175
if should_broadcast {
31793176
let funding_outp = HolderFundingOutput::build(self.funding_redeemscript.clone(), self.channel_value_satoshis, self.onchain_tx_handler.opt_anchors());
3180-
let commitment_package = PackageTemplate::build_package(self.funding_info.0.txid.clone(), self.funding_info.0.index as u32, PackageSolvingData::HolderFundingOutput(funding_outp), self.best_block.height(), false, self.best_block.height());
3177+
let commitment_package = PackageTemplate::build_package(self.funding_info.0.txid.clone(), self.funding_info.0.index as u32, PackageSolvingData::HolderFundingOutput(funding_outp), self.best_block.height(), self.best_block.height());
31813178
claimable_outpoints.push(commitment_package);
31823179
self.pending_monitor_events.push(MonitorEvent::CommitmentTxConfirmed(self.funding_info.0));
31833180
let commitment_tx = self.onchain_tx_handler.get_fully_signed_holder_tx(&self.funding_redeemscript);

0 commit comments

Comments
 (0)