Repository navigation
Conversation
|
|
||
| let mut competing_input = tx1.body.inputs()[0].clone(); | ||
| competing_input.script_signature = tx2.body.inputs()[0].script_signature.clone(); | ||
| assert_ne!(&competing_input, &tx1.body.inputs()[0]); |
Contributor
There was a problem hiding this comment.
assert_ne! always fails here because TransactionInput::eq compares only output_hash(). Changing script_signature leaves these inputs equal, so the test stops before checking pool removal. Compare the two script_signature fields or their canonical_hash() values instead.
Suggested change
| assert_ne!(&competing_input, &tx1.body.inputs()[0]); | |
| assert_ne!(competing_input.script_signature, tx1.body.inputs()[0].script_signature); |
aswadi
force-pushed
the
fix/reorg-pool-discard-double-spends-output-hash
branch
from
November 30, 2026 14:30
c43303e to
e1eb873
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ReorgPool::discard_double_spendspreviously checkedpublished_block.body.inputs().contains(input), which compares fullTransactionInputequality (includingscript_signature,input_data, andSpentOutputrepresentation) instead of the spent UTXO'soutput_hash(). As a result, competing transactions in theReorgPoolthat spend the same output with a differentscript_signaturewere not discarded when a conflicting block was added during a reorg.Changes
output_hash()values frompublished_block.body.inputs()inReorgPool::discard_double_spendsand discard anyReorgPooltransaction that spends a matchingoutput_hash().discard_double_spends_matches_competing_spend_by_output_hashverifying that a competing spend with a distinctscript_signatureis removed fromReorgPooland all pool indexes remain consistent.Fix the new test's always-failing equality assertion before merging.
Summary
ReorgPool::discard_double_spendsnow builds a set of spent output hashes and selects each conflicting transaction once.Reviews (1) · Last reviewed commit: "fix(mempool): compare input output_hash ..." · Reviewed by Greptile