Skip to content

Commit 3625dfa

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 9b8b7de commit 3625dfa

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

src/ln/channelmonitor.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,15 +2244,13 @@ impl ChannelMonitor {
22442244
}
22452245
}
22462246
}
2247-
let mut pending_claims = Vec::new();
22482247
if let Some(ref cur_local_tx) = self.current_local_signed_commitment_tx {
22492248
if self.would_broadcast_at_height(height) {
22502249
broadcaster.broadcast_transaction(&cur_local_tx.tx);
22512250
match self.key_storage {
22522251
Storage::Local { ref delayed_payment_base_key, ref latest_per_commitment_point, .. } => {
2253-
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);
2252+
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);
22542253
spendable_outputs.append(&mut spendable_output);
2255-
pending_claims.append(&mut pending_txn);
22562254
if !new_outputs.is_empty() {
22572255
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
22582256
}
@@ -2261,9 +2259,8 @@ impl ChannelMonitor {
22612259
}
22622260
},
22632261
Storage::Watchtower { .. } => {
2264-
let (txs, mut spendable_output, new_outputs, mut pending_txn) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
2262+
let (txs, mut spendable_output, new_outputs, _) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
22652263
spendable_outputs.append(&mut spendable_output);
2266-
pending_claims.append(&mut pending_txn);
22672264
if !new_outputs.is_empty() {
22682265
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
22692266
}
@@ -2274,12 +2271,6 @@ impl ChannelMonitor {
22742271
}
22752272
}
22762273
}
2277-
for claim in pending_claims {
2278-
match self.our_claim_txn_waiting_first_conf.entry(claim.0) {
2279-
hash_map::Entry::Occupied(_) => {},
2280-
hash_map::Entry::Vacant(entry) => { entry.insert(claim.1); }
2281-
}
2282-
}
22832274
if let Some(events) = self.onchain_events_waiting_threshold_conf.remove(&height) {
22842275
for ev in events {
22852276
match ev {

0 commit comments

Comments
 (0)