Conversation
deadmanoz
marked this pull request as draft
September 11, 2026 08:39
deadmanoz
force-pushed
the
missing-unconfirmed-parent
branch
from
September 11, 2026 08:40
ad2790c to
c7d24f5
Compare
Collaborator
Author
|
Drafting because I need to update the observation source in merge-mining-research so that the JSON entry has the correct "final" link (it needs to be demoted in that dataset to an error block) |
deadmanoz
force-pushed
the
missing-unconfirmed-parent
branch
from
September 11, 2026 08:51
c7d24f5 to
8e70c0b
Compare
deadmanoz
added a commit
to deadmanoz/stale-blocks
that referenced
this pull request
Sep 11, 2026
1Hash block 00000000000000000182acdf5657c93a0769dc6f9004047496b2e15efc6a4232 spends an output whose parent transaction confirmed only in the same-height competitor. That is bad-txns-inputs-missingorspent at connect time, not an in-block ordering error. The replacement record and binary are in bitcoin-data/invalid-blocks#5. Point the README at the companion repository rather than the pre-474294 tree snapshot.
cursor Bot
pushed a commit
to deadmanoz/stale-blocks
that referenced
this pull request
Sep 15, 2026
1Hash block 00000000000000000182acdf5657c93a0769dc6f9004047496b2e15efc6a4232 spends an output whose parent transaction confirmed only in the same-height competitor. That is bad-txns-inputs-missingorspent at connect time, not an in-block ordering error. The replacement record and binary are in bitcoin-data/invalid-blocks#5. Point the README at the companion repository rather than the pre-474294 tree snapshot.
deadmanoz
added a commit
to deadmanoz/stale-blocks
that referenced
this pull request
Sep 15, 2026
1Hash block 00000000000000000182acdf5657c93a0769dc6f9004047496b2e15efc6a4232 spends an output whose parent transaction confirmed only in the same-height competitor. That is bad-txns-inputs-missingorspent at connect time, not an in-block ordering error. The replacement record and binary are in bitcoin-data/invalid-blocks#5. Point the README at the companion repository rather than the pre-474294 tree snapshot.
…ce lookups Split the download into a bounded HTTP read and a retry loop that takes the URL path, and move the cache into one helper that decodes a cached file or downloads, decodes and then stores the reply, so other evidence lookups can share the pacing, provider fallback, size limit and atomic write. Expose the per-transaction loader that the pool runs.
The in-block forward-spend checker cannot see a parent transaction that
confirmed only in a competing same-height block. Add a
missing_unconfirmed_parent rule whose record names the failing outpoint
in missing_prevout, and the 1Hash body so ConnectBlock's
missing-or-spent failure is re-derivable.
CI requires the body to spend that outpoint from outside the block,
requires a public API's block hash at the previous height to equal
prev_hash, fetches the parent transaction and checks its txid and the
output index, and requires the API to report that transaction confirmed
in another block at this height or later. The canonical previous block
is what makes the inference hold. Cache files are {txid}.bin, the raw
{txid}.status.json reply and height-{n}.hash.
deadmanoz
force-pushed
the
missing-unconfirmed-parent
branch
from
September 15, 2026 09:09
8e70c0b to
2ed2222
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
Adds a
missing_unconfirmed_parentevidence rule and the first block it admits: height 474294,00000000000000000182acdf5657c93a0769dc6f9004047496b2e15efc6a4232, mined by 1Hash in July 2017.Transaction 110 of the block spends
b11a78c6c61af1cb37586f639050d74b95c2b0fd525623b6cb6a4bb4fba46a0e:1. That parent transaction is not in the block and did not exist at the tip of 474293, soConnectBlockfails withbad-txns-inputs-missingorspent. Both transactions confirmed in the same-height competitor000000000000000000db2504327e272fe7658fac0dd0741f46b212256e500886.The existing
bad-txns-inputs-missingorspentchecker (477115, 809478) only recognises a parent that appears later in the same block. 474294 has none, and a prevout absent from the body is what every valid block looks like, so absence alone cannot be the evidence. The record therefore names the failing outpoint in a newmissing_prevoutcontext field, and CI checks that one outpoint rather than searching the block's 2,141 outside parents for one that happens to fit.CI admits the record only if the body spends the recorded outpoint from a transaction that is not in the block; a public Esplora API reports
prev_hashas the block at height 474293, so the candidate extends the canonical chain; the parent transaction is fetched, verified by txid and contains the spent output; and the API currently reports that transaction confirmed in another block at this height or later. That is, the parent was not in the chain below the candidate, so its output did not exist when the block was mined. An unconfirmed or unknown parent is not evidence, and a parent confirmed below this height is a normal spend.CI does not rebuild the UTXO set at 474293 or replay
ConnectBlock. It trusts the configured providers for the confirmation and the canonical hash (mempool.space and blockstream.info agree on the parent's confirmation), and the cached replies are snapshots from their first fetch.parent_kindremains a descriptive field on every record; the schema now says so.Changes
ci/prevouts.py: one fetch helper that returns bytes and one cached-lookup helper that decodes a file or downloads, decodes and then stores the reply. The same two functions now serve previous transactions ({txid}.bin), the/tx/{txid}/statusreply ({txid}.status.json) and the/block-height/{n}reply (height-{n}.hash). That refactor is the first commit and changes nothing for the sigops path.ci/block_evidence.pyandci/sanity-check.py:omitted_prevouts, theconfirmed_at_or_afterinference, theRULESentry requiringmissing_prevout, and themissing_parentevidence mode.data/invalid-blocks.jsonlandblocks/474294-….bin, byte-identical to the copy in bitcoin-data/stale-blocks at2633e0e. Observations: the merge-mining-research Namecoin witness at child height 349887 and the chainquery.com orphan listing in NStifter/mergedmonitor. merge-mining-research still classifies the block as a stale; that reclassification is a separate change, after which the observation link will be repinned.docs/schema.mdanddocs/notes.md: themissing_prevoutfield, the evidence contract row, a section on why a later confirmation elsewhere proves the failure, and a plainer explanation of whyConnectBlocknever runs when one of these blocks is replayed today.Testing
python ci/sanity-check.py --fetch-prevoutsadmits 47 blocks with 6 block files and prints the fetched evidence for 474294: parent confirmed at 474294 in…500886, canonical block at 474293 equal to the record'sprev_hash. The offline run passes with the three cached files present and fails naming the missing entry when the cache is incomplete.python -m unittest discover -s ci -p 'test_*.py'runs 32 tests. CI on this head: run 34950924462.Related
bitcoin-data/stale-blocks#139 removes the invalid block from stale-blocks once this is published.
Original discussion: https://bitcointalk.org/index.php?topic=2041607.0.