Skip to content

Commit 7d1b4a5

Browse files
author
Antoine Riard
committed
Remove aggregable flag from PackageTemplate constructor
1 parent b081792 commit 7d1b4a5

File tree

3 files changed

+85
-93
lines changed

3 files changed

+85
-93
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 10 additions & 12 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,
@@ -2605,8 +2605,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
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);
26072607
// 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);
2608+
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);
26102609
claimable_outpoints.push(justice_package);
26112610
to_counterparty_output_info =
26122611
Some((idx.try_into().expect("Txn can't have more than 2^32 outputs"), outp.value));
@@ -2624,7 +2623,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
26242623
to_counterparty_output_info);
26252624
}
26262625
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);
2626+
let justice_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, PackageSolvingData::RevokedHTLCOutput(revk_htlc_outp), htlc.cltv_expiry, height);
26282627
claimable_outpoints.push(justice_package);
26292628
}
26302629
}
@@ -2749,8 +2748,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
27492748
self.counterparty_commitment_params.counterparty_htlc_base_key,
27502749
htlc.clone(), self.onchain_tx_handler.opt_anchors()))
27512750
};
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);
2751+
let counterparty_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc.cltv_expiry, 0);
27542752
claimable_outpoints.push(counterparty_package);
27552753
}
27562754
}
@@ -2794,7 +2792,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
27942792
);
27952793
let justice_package = PackageTemplate::build_package(
27962794
htlc_txid, idx as u32, PackageSolvingData::RevokedOutput(revk_outp),
2797-
height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, true, height
2795+
height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, height
27982796
);
27992797
claimable_outpoints.push(justice_package);
28002798
if outputs_to_watch.is_none() {
@@ -2817,11 +2815,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28172815

28182816
for &(ref htlc, _, _) in holder_tx.htlc_outputs.iter() {
28192817
if let Some(transaction_output_index) = htlc.transaction_output_index {
2820-
let (htlc_output, aggregable) = if htlc.offered {
2818+
let htlc_output = if htlc.offered {
28212819
let htlc_output = HolderHTLCOutput::build_offered(
28222820
htlc.amount_msat, htlc.cltv_expiry, self.onchain_tx_handler.opt_anchors()
28232821
);
2824-
(htlc_output, false)
2822+
htlc_output
28252823
} else {
28262824
let payment_preimage = if let Some(preimage) = self.payment_preimages.get(&htlc.payment_hash) {
28272825
preimage.clone()
@@ -2832,12 +2830,12 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28322830
let htlc_output = HolderHTLCOutput::build_accepted(
28332831
payment_preimage, htlc.amount_msat, self.onchain_tx_handler.opt_anchors()
28342832
);
2835-
(htlc_output, self.onchain_tx_handler.opt_anchors())
2833+
htlc_output
28362834
};
28372835
let htlc_package = PackageTemplate::build_package(
28382836
holder_tx.txid, transaction_output_index,
28392837
PackageSolvingData::HolderHTLCOutput(htlc_output),
2840-
htlc.cltv_expiry, aggregable, conf_height
2838+
htlc.cltv_expiry, conf_height
28412839
);
28422840
claim_requests.push(htlc_package);
28432841
}
@@ -3177,7 +3175,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31773175
let should_broadcast = self.should_broadcast_holder_commitment_txn(logger);
31783176
if should_broadcast {
31793177
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());
3178+
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());
31813179
claimable_outpoints.push(commitment_package);
31823180
self.pending_monitor_events.push(MonitorEvent::CommitmentTxConfirmed(self.funding_info.0));
31833181
let commitment_tx = self.onchain_tx_handler.get_fully_signed_holder_tx(&self.funding_redeemscript);

0 commit comments

Comments
 (0)