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