Skip to content

Commit 2f549ee

Browse files
committed
Rename claim cleaning match bool for accuracy
We don't actually care if a confirmed transaction claimed other outputs, only that it claimed a superset of the outputs in the pending claim we're looking at. Thus, the variable to detect that is renamed `is_claim_subset_of_tx` instead of `are_sets_equal`.
1 parent bc1931b commit 2f549ee

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lightning/src/chain/onchaintx.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -885,15 +885,16 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
885885
if let Some((claim_id, _)) = self.claimable_outpoints.get(&inp.previous_output) {
886886
// If outpoint has claim request pending on it...
887887
if let Some(request) = self.pending_claim_requests.get_mut(claim_id) {
888-
//... we need to verify equality between transaction outpoints and claim request
889-
// outpoints to know if transaction is the original claim or a bumped one issued
890-
// by us.
891-
let mut are_sets_equal = true;
888+
//... we need to check if the pending claim was for a subset of the outputs
889+
// spent by the confirmed transaction. If so, we can drop the pending claim
890+
// after ANTI_REORG_DELAY blocks, otherwise we need to split it and retry
891+
// claiming the remaining outputs.
892+
let mut is_claim_subset_of_tx = true;
892893
let mut tx_inputs = tx.input.iter().map(|input| &input.previous_output).collect::<Vec<_>>();
893894
tx_inputs.sort_unstable();
894895
for request_input in request.outpoints() {
895896
if tx_inputs.binary_search(&request_input).is_err() {
896-
are_sets_equal = false;
897+
is_claim_subset_of_tx = false;
897898
break;
898899
}
899900
}
@@ -915,7 +916,7 @@ impl<ChannelSigner: EcdsaChannelSigner> OnchainTxHandler<ChannelSigner> {
915916
// If this is our transaction (or our counterparty spent all the outputs
916917
// before we could anyway with same inputs order than us), wait for
917918
// ANTI_REORG_DELAY and clean the RBF tracking map.
918-
if are_sets_equal {
919+
if is_claim_subset_of_tx {
919920
clean_claim_request_after_safety_delay!();
920921
} else { // If false, generate new claim request with update outpoint set
921922
let mut at_least_one_drop = false;

0 commit comments

Comments
 (0)