Skip to content

Commit 6a7c471

Browse files
Antoine RiardTheBlueMatt
authored andcommitted
Remove superflous pending_claims
As local onchain txn are already monitored in block_connected by check_spend_local_transaction, it's useless to generate twice pending claims for HTLC outputs on local commitment tx. We could do the alternative.
1 parent 0011713 commit 6a7c471

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

lightning/src/ln/channelmonitor.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,16 +2383,14 @@ impl ChannelMonitor {
23832383
}
23842384
}
23852385
}
2386-
let mut pending_claims = Vec::new();
23872386
if let Some(ref cur_local_tx) = self.current_local_signed_commitment_tx {
23882387
if self.would_broadcast_at_height(height) {
23892388
log_trace!(self, "Broadcast onchain {}", log_tx!(cur_local_tx.tx));
23902389
broadcaster.broadcast_transaction(&cur_local_tx.tx);
23912390
match self.key_storage {
23922391
Storage::Local { ref delayed_payment_base_key, ref latest_per_commitment_point, .. } => {
2393-
let (txs, mut spendable_output, new_outputs, mut pending_txn) = self.broadcast_by_local_state(&cur_local_tx, latest_per_commitment_point, &Some(*delayed_payment_base_key), height);
2392+
let (txs, mut spendable_output, new_outputs, _) = self.broadcast_by_local_state(&cur_local_tx, latest_per_commitment_point, &Some(*delayed_payment_base_key), height);
23942393
spendable_outputs.append(&mut spendable_output);
2395-
pending_claims.append(&mut pending_txn);
23962394
if !new_outputs.is_empty() {
23972395
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
23982396
}
@@ -2402,9 +2400,8 @@ impl ChannelMonitor {
24022400
}
24032401
},
24042402
Storage::Watchtower { .. } => {
2405-
let (txs, mut spendable_output, new_outputs, mut pending_txn) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
2403+
let (txs, mut spendable_output, new_outputs, _) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
24062404
spendable_outputs.append(&mut spendable_output);
2407-
pending_claims.append(&mut pending_txn);
24082405
if !new_outputs.is_empty() {
24092406
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
24102407
}
@@ -2416,12 +2413,6 @@ impl ChannelMonitor {
24162413
}
24172414
}
24182415
}
2419-
for claim in pending_claims {
2420-
match self.pending_claim_requests.entry(claim.0) {
2421-
hash_map::Entry::Occupied(_) => {},
2422-
hash_map::Entry::Vacant(entry) => { entry.insert(claim.1); }
2423-
}
2424-
}
24252416
if let Some(events) = self.onchain_events_waiting_threshold_conf.remove(&height) {
24262417
for ev in events {
24272418
match ev {

0 commit comments

Comments
 (0)