Skip to content

Commit b976887

Browse files
author
Antoine Riard
committed
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 82170b0 commit b976887

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
@@ -2253,16 +2253,14 @@ impl ChannelMonitor {
22532253
}
22542254
}
22552255
}
2256-
let mut pending_claims = Vec::new();
22572256
if let Some(ref cur_local_tx) = self.current_local_signed_commitment_tx {
22582257
if self.would_broadcast_at_height(height) {
22592258
log_trace!(self, "Broadcast onchain {}", log_tx!(cur_local_tx.tx));
22602259
broadcaster.broadcast_transaction(&cur_local_tx.tx);
22612260
match self.key_storage {
22622261
Storage::Local { ref delayed_payment_base_key, ref latest_per_commitment_point, .. } => {
2263-
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);
2262+
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);
22642263
spendable_outputs.append(&mut spendable_output);
2265-
pending_claims.append(&mut pending_txn);
22662264
if !new_outputs.is_empty() {
22672265
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
22682266
}
@@ -2272,9 +2270,8 @@ impl ChannelMonitor {
22722270
}
22732271
},
22742272
Storage::Watchtower { .. } => {
2275-
let (txs, mut spendable_output, new_outputs, mut pending_txn) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
2273+
let (txs, mut spendable_output, new_outputs, _) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
22762274
spendable_outputs.append(&mut spendable_output);
2277-
pending_claims.append(&mut pending_txn);
22782275
if !new_outputs.is_empty() {
22792276
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
22802277
}
@@ -2286,12 +2283,6 @@ impl ChannelMonitor {
22862283
}
22872284
}
22882285
}
2289-
for claim in pending_claims {
2290-
match self.our_claim_txn_waiting_first_conf.entry(claim.0) {
2291-
hash_map::Entry::Occupied(_) => {},
2292-
hash_map::Entry::Vacant(entry) => { entry.insert(claim.1); }
2293-
}
2294-
}
22952286
if let Some(events) = self.onchain_events_waiting_threshold_conf.remove(&height) {
22962287
for ev in events {
22972288
match ev {

0 commit comments

Comments
 (0)