Repository navigation
mempool: decode a confirmed parent once per coin lookup #969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
reardencode
merged 3 commits into
reardencode:master
from
average-gary:mempool/prevout-decode-once
Oct 9, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| Changed | ||
|
|
||
| - **Mempool accept decodes a confirmed parent once per coin lookup.** Resolving | ||
| a spent coin reads the parent's packed outputs once; the fk resolve verifies | ||
| `txid.body` only and coinbase-ness comes from the block's first tx, not a | ||
| second decode of the parent's inputs. The `getblocktemplate` proposal check | ||
| shares that lookup and re-reads the create's fence height before spending | ||
| the cached output, so a disconnect during the check cannot price a coin | ||
| that has left the best chain. A failed coinbase-table read leaves the | ||
| mempool coin unavailable instead of treating it as a non-coinbase. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coinbase_spend_is_immatureused to calltx_height_get(create_fk)and returnbad-txns-inputs-missingorspentwhen the fence had no height.created_his now the height captured inconfirmed_parent_outputs, and this early return trusts it with no further fence read.chain_txoutthen treats the memo entry as spendable wheneveris_outpoint_spentis false. After a disconnect,has_confirmed_strong_spender_atresolves withget_fk_by_txid_tipand returns false when that create is no longer on the best chain, so the stale memo entry is priced as a valid input. This applies to every confirmed parent, including ones already past maturity, because this branch returns beforeis_coinbase_create.getblocktemplateproposal mode calls this with no UTXO-view stamp check. Connect and disconnect holdutxo_viewwhile they publish (query/connect.rs,confirm_run/phases.rs); a proposal that overlaps that publish can accept a spend of a coin that has left the best chain.Restore a fence check on
create_fkbefore trusting the cached height (a missing height staysbad-txns-inputs-missingorspent), or fail the proposal when the view stamp moves between the parent pre-pass and the end ofproposal_connect.