Skip to content

Commit f407b2c

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 831df37 commit f407b2c

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
@@ -2236,15 +2236,13 @@ impl ChannelMonitor {
22362236
}
22372237
}
22382238
}
2239-
let mut pending_claims = Vec::new();
22402239
if let Some(ref cur_local_tx) = self.current_local_signed_commitment_tx {
22412240
if self.would_broadcast_at_height(height) {
22422241
broadcaster.broadcast_transaction(&cur_local_tx.tx);
22432242
match self.key_storage {
22442243
Storage::Local { ref delayed_payment_base_key, ref latest_per_commitment_point, .. } => {
2245-
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);
2244+
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);
22462245
spendable_outputs.append(&mut spendable_output);
2247-
pending_claims.append(&mut pending_txn);
22482246
if !new_outputs.is_empty() {
22492247
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
22502248
}
@@ -2253,9 +2251,8 @@ impl ChannelMonitor {
22532251
}
22542252
},
22552253
Storage::Watchtower { .. } => {
2256-
let (txs, mut spendable_output, new_outputs, mut pending_txn) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
2254+
let (txs, mut spendable_output, new_outputs, _) = self.broadcast_by_local_state(&cur_local_tx, &None, &None, height);
22572255
spendable_outputs.append(&mut spendable_output);
2258-
pending_claims.append(&mut pending_txn);
22592256
if !new_outputs.is_empty() {
22602257
watch_outputs.push((cur_local_tx.txid.clone(), new_outputs));
22612258
}
@@ -2266,12 +2263,6 @@ impl ChannelMonitor {
22662263
}
22672264
}
22682265
}
2269-
for claim in pending_claims {
2270-
match self.our_claim_txn_waiting_first_conf.entry(claim.0) {
2271-
hash_map::Entry::Occupied(_) => {},
2272-
hash_map::Entry::Vacant(entry) => { entry.insert(claim.1); }
2273-
}
2274-
}
22752266
if let Some(events) = self.onchain_events_waiting_threshold_conf.remove(&height) {
22762267
for ev in events {
22772268
match ev {

0 commit comments

Comments
 (0)