Skip to content

Commit ccaf9e5

Browse files
author
Antoine Riard
committed
Anchor: do not aggregate claim of revoked output
See lightning/bolts#803 This protect the justice claim of counterparty revoked output. As otherwise if the all the revoked outputs claims are batched in a single transaction, low-feerate HTLCs transactions can delay our honest justice claim transaction until BREAKDOWN_TIMEOUT expires.
1 parent 505102d commit ccaf9e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,8 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
24372437
for (idx, outp) in tx.output.iter().enumerate() {
24382438
if outp.script_pubkey == revokeable_p2wsh {
24392439
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);
2440-
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, true, height);
2440+
let aggregation = if self.onchain_tx_handler.opt_anchors() { false } else { true };
2441+
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);
24412442
claimable_outpoints.push(justice_package);
24422443
to_counterparty_output_info =
24432444
Some((idx.try_into().expect("Txn can't have more than 2^32 outputs"), outp.value));

0 commit comments

Comments
 (0)