@@ -2331,7 +2331,7 @@ impl ChannelMonitor {
2331
2331
let mut watch_outputs = Vec :: new ( ) ;
2332
2332
let mut spendable_outputs = Vec :: new ( ) ;
2333
2333
let mut htlc_updated = Vec :: new ( ) ;
2334
- let mut bump_candidates = Vec :: new ( ) ;
2334
+ let mut bump_candidates = HashMap :: new ( ) ;
2335
2335
for tx in txn_matched {
2336
2336
if tx. input . len ( ) == 1 {
2337
2337
// Assuming our keys were not leaked (in which case we're screwed no matter what),
@@ -2436,7 +2436,7 @@ impl ChannelMonitor {
2436
2436
}
2437
2437
}
2438
2438
//TODO: recompute soonest_timelock to avoid wasting a bit on fees
2439
- bump_candidates. push ( ( ancestor_claimable_txid. 0 . clone ( ) , claim_material. clone ( ) ) ) ;
2439
+ bump_candidates. insert ( ancestor_claimable_txid. 0 . clone ( ) , claim_material. clone ( ) ) ;
2440
2440
}
2441
2441
break ; //No need to iterate further, either tx is our or their
2442
2442
} else {
@@ -2512,17 +2512,19 @@ impl ChannelMonitor {
2512
2512
}
2513
2513
for ( ancestor_claim_txid, ref mut cached_claim_datas) in self . pending_claim_requests . iter_mut ( ) {
2514
2514
if cached_claim_datas. height_timer == height {
2515
- bump_candidates. push ( ( ancestor_claim_txid. clone ( ) , cached_claim_datas. clone ( ) ) ) ;
2515
+ if let hash_map:: Entry :: Vacant ( entry) = bump_candidates. entry ( ancestor_claim_txid. clone ( ) ) {
2516
+ entry. insert ( cached_claim_datas. clone ( ) ) ;
2517
+ }
2516
2518
}
2517
2519
}
2518
- for & mut ( _ , ref mut cached_claim_datas) in bump_candidates. iter_mut ( ) {
2520
+ for ref mut cached_claim_datas in bump_candidates. values_mut ( ) {
2519
2521
if let Some ( ( new_timer, new_feerate, bump_tx) ) = self . bump_claim_tx ( height, & cached_claim_datas, fee_estimator) {
2520
2522
cached_claim_datas. height_timer = new_timer;
2521
2523
cached_claim_datas. feerate_previous = new_feerate;
2522
2524
broadcaster. broadcast_transaction ( & bump_tx) ;
2523
2525
}
2524
2526
}
2525
- for ( ancestor_claim_txid, cached_claim_datas) in bump_candidates. drain ( .. ) {
2527
+ for ( ancestor_claim_txid, cached_claim_datas) in bump_candidates. drain ( ) {
2526
2528
self . pending_claim_requests . insert ( ancestor_claim_txid, cached_claim_datas) ;
2527
2529
}
2528
2530
self . last_block_hash = block_hash. clone ( ) ;
0 commit comments