Skip to content

Commit 762f1c3

Browse files
committed
Use current height when generating claims on block_disconnected
The `height` argument passed to `OnchainTxHandler::block_disconnected` represents the height being disconnected, and not the current height. Due to the incorrect assumption, we'd generate a claim with a locktime in the future. Ultimately, we shouldn't be generating claims within `block_disconnected`. Rather, we should retry the claim at a later block height, since the bitcoin blockchain does not ever roll back without connecting a new block. Addressing this is left for future work.
1 parent 02ae5cb commit 762f1c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/chain/onchaintx.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,10 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
10361036
}
10371037
}
10381038
for ((_package_id, _), ref mut request) in bump_candidates.iter_mut() {
1039+
// `height` is the height being disconnected, so our `current_height` is 1 lower.
1040+
let current_height = height - 1;
10391041
if let Some((new_timer, new_feerate, bump_claim)) = self.generate_claim(
1040-
height, &request, true /* force_feerate_bump */, fee_estimator, &&*logger
1042+
current_height, &request, true /* force_feerate_bump */, fee_estimator, &&*logger
10411043
) {
10421044
request.set_timer(new_timer);
10431045
request.set_feerate(new_feerate);

0 commit comments

Comments
 (0)