@@ -1112,15 +1112,15 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
11121112 }
11131113
11141114 if let Some ( height) = height {
1115- self . block_disconnected (
1116- height, broadcaster, conf_target, destination_script, fee_estimator, logger,
1115+ self . blocks_disconnected (
1116+ height - 1 , broadcaster, conf_target, destination_script, fee_estimator, logger,
11171117 ) ;
11181118 }
11191119 }
11201120
11211121 #[ rustfmt:: skip]
1122- pub ( super ) fn block_disconnected < B : Deref , F : Deref , L : Logger > (
1123- & mut self , height : u32 , broadcaster : B , conf_target : ConfirmationTarget ,
1122+ pub ( super ) fn blocks_disconnected < B : Deref , F : Deref , L : Logger > (
1123+ & mut self , new_best_height : u32 , broadcaster : B , conf_target : ConfirmationTarget ,
11241124 destination_script : & Script , fee_estimator : & LowerBoundedFeeEstimator < F > , logger : & L ,
11251125 )
11261126 where B :: Target : BroadcasterInterface ,
@@ -1130,14 +1130,14 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
11301130 let onchain_events_awaiting_threshold_conf =
11311131 self . onchain_events_awaiting_threshold_conf . drain ( ..) . collect :: < Vec < _ > > ( ) ;
11321132 for entry in onchain_events_awaiting_threshold_conf {
1133- if entry. height >= height {
1133+ if entry. height > new_best_height {
11341134 //- our claim tx on a commitment tx output
11351135 //- resurect outpoint back in its claimable set and regenerate tx
11361136 match entry. event {
11371137 OnchainEvent :: ContentiousOutpoint { package } => {
11381138 if let Some ( pending_claim) = self . claimable_outpoints . get ( package. outpoints ( ) [ 0 ] ) {
11391139 if let Some ( request) = self . pending_claim_requests . get_mut ( & pending_claim. 0 ) {
1140- assert ! ( request. merge_package( package, height ) . is_ok( ) ) ;
1140+ assert ! ( request. merge_package( package, new_best_height + 1 ) . is_ok( ) ) ;
11411141 // Using a HashMap guarantee us than if we have multiple outpoints getting
11421142 // resurrected only one bump claim tx is going to be broadcast
11431143 bump_candidates. insert ( pending_claim. clone ( ) , request. clone ( ) ) ;
@@ -1151,10 +1151,8 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
11511151 }
11521152 }
11531153 for ( ( _claim_id, _) , ref mut request) in bump_candidates. iter_mut ( ) {
1154- // `height` is the height being disconnected, so our `current_height` is 1 lower.
1155- let current_height = height - 1 ;
11561154 if let Some ( ( new_timer, new_feerate, bump_claim) ) = self . generate_claim (
1157- current_height , & request, & FeerateStrategy :: ForceBump , conf_target,
1155+ new_best_height , & request, & FeerateStrategy :: ForceBump , conf_target,
11581156 destination_script, fee_estimator, logger
11591157 ) {
11601158 request. set_timer ( new_timer) ;
@@ -1188,9 +1186,9 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
11881186 // right now if one of the outpoint get disconnected, just erase whole pending claim request.
11891187 let mut remove_request = Vec :: new ( ) ;
11901188 self . claimable_outpoints . retain ( |_, ref v|
1191- if v. 1 >= height {
1192- remove_request. push ( v. 0 . clone ( ) ) ;
1193- false
1189+ if v. 1 > new_best_height {
1190+ remove_request. push ( v. 0 . clone ( ) ) ;
1191+ false
11941192 } else { true } ) ;
11951193 for req in remove_request {
11961194 self . pending_claim_requests . remove ( & req) ;
0 commit comments