Skip to content

Commit dba8d68

Browse files
author
Antoine Riard
committed
Remove aggregable flag from PackageTemplate constructor
1 parent a1eebd2 commit dba8d68

File tree

2 files changed

+71
-66
lines changed

2 files changed

+71
-66
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,7 +2408,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
24082408
let commitment_package = PackageTemplate::build_package(
24092409
self.funding_info.0.txid.clone(), self.funding_info.0.index as u32,
24102410
PackageSolvingData::HolderFundingOutput(funding_output),
2411-
best_block_height, false, best_block_height,
2411+
best_block_height, best_block_height
24122412
);
24132413
self.onchain_tx_handler.update_claims_view_from_requests(
24142414
vec![commitment_package], best_block_height, best_block_height,
@@ -2591,8 +2591,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
25912591
if outp.script_pubkey == revokeable_p2wsh {
25922592
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);
25932593
// Post-anchor, aggregation of outputs of different types is unsafe. See https://github.com/lightning/bolts/pull/803.
2594-
let aggregation = if self.onchain_tx_handler.opt_anchors() { false } else { true };
2595-
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);
2594+
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);
25962595
claimable_outpoints.push(justice_package);
25972596
to_counterparty_output_info =
25982597
Some((idx.try_into().expect("Txn can't have more than 2^32 outputs"), outp.value));
@@ -2610,7 +2609,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
26102609
to_counterparty_output_info);
26112610
}
26122611
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());
2613-
let justice_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, PackageSolvingData::RevokedHTLCOutput(revk_htlc_outp), htlc.cltv_expiry, true, height);
2612+
let justice_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, PackageSolvingData::RevokedHTLCOutput(revk_htlc_outp), htlc.cltv_expiry, height);
26142613
claimable_outpoints.push(justice_package);
26152614
}
26162615
}
@@ -2735,8 +2734,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
27352734
self.counterparty_commitment_params.counterparty_htlc_base_key,
27362735
htlc.clone(), self.onchain_tx_handler.opt_anchors()))
27372736
};
2738-
let aggregation = if !htlc.offered { false } else { true };
2739-
let counterparty_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc.cltv_expiry,aggregation, 0);
2737+
let counterparty_package = PackageTemplate::build_package(commitment_txid, transaction_output_index, counterparty_htlc_outp, htlc.cltv_expiry, 0);
27402738
claimable_outpoints.push(counterparty_package);
27412739
}
27422740
}
@@ -2780,7 +2778,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
27802778
);
27812779
let justice_package = PackageTemplate::build_package(
27822780
htlc_txid, idx as u32, PackageSolvingData::RevokedOutput(revk_outp),
2783-
height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, true, height
2781+
height + self.counterparty_commitment_params.on_counterparty_tx_csv as u32, height
27842782
);
27852783
claimable_outpoints.push(justice_package);
27862784
if outputs_to_watch.is_none() {
@@ -2803,11 +2801,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28032801

28042802
for &(ref htlc, _, _) in holder_tx.htlc_outputs.iter() {
28052803
if let Some(transaction_output_index) = htlc.transaction_output_index {
2806-
let (htlc_output, aggregable) = if htlc.offered {
2804+
let htlc_output = if htlc.offered {
28072805
let htlc_output = HolderHTLCOutput::build_offered(
28082806
htlc.amount_msat, htlc.cltv_expiry, self.onchain_tx_handler.opt_anchors()
28092807
);
2810-
(htlc_output, false)
2808+
htlc_output
28112809
} else {
28122810
let payment_preimage = if let Some(preimage) = self.payment_preimages.get(&htlc.payment_hash) {
28132811
preimage.clone()
@@ -2818,12 +2816,12 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
28182816
let htlc_output = HolderHTLCOutput::build_accepted(
28192817
payment_preimage, htlc.amount_msat, self.onchain_tx_handler.opt_anchors()
28202818
);
2821-
(htlc_output, self.onchain_tx_handler.opt_anchors())
2819+
htlc_output
28222820
};
28232821
let htlc_package = PackageTemplate::build_package(
28242822
holder_tx.txid, transaction_output_index,
28252823
PackageSolvingData::HolderHTLCOutput(htlc_output),
2826-
htlc.cltv_expiry, aggregable, conf_height
2824+
htlc.cltv_expiry, conf_height
28272825
);
28282826
claim_requests.push(htlc_package);
28292827
}
@@ -3163,7 +3161,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31633161
let should_broadcast = self.should_broadcast_holder_commitment_txn(logger);
31643162
if should_broadcast {
31653163
let funding_outp = HolderFundingOutput::build(self.funding_redeemscript.clone(), self.channel_value_satoshis, self.onchain_tx_handler.opt_anchors());
3166-
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());
3164+
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());
31673165
claimable_outpoints.push(commitment_package);
31683166
self.pending_monitor_events.push(MonitorEvent::CommitmentTxConfirmed(self.funding_info.0));
31693167
let commitment_tx = self.onchain_tx_handler.get_fully_signed_holder_tx(&self.funding_redeemscript);

0 commit comments

Comments
 (0)