Skip to content

Admit 1Hash block 474294 under a new missing-parent-transaction rule - #5

Draft
deadmanoz wants to merge 2 commits into
mainfrom
missing-unconfirmed-parent
Draft

deadmanoz wants to merge 2 commits into
mainfrom
missing-unconfirmed-parent

Conversation

@deadmanoz

@deadmanoz deadmanoz commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a missing_unconfirmed_parent evidence 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, so ConnectBlock fails with bad-txns-inputs-missingorspent. Both transactions confirmed in the same-height competitor 000000000000000000db2504327e272fe7658fac0dd0741f46b212256e500886.

The existing bad-txns-inputs-missingorspent checker (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 new missing_prevout context 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_hash as 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_kind remains 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}/status reply ({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.py and ci/sanity-check.py: omitted_prevouts, the confirmed_at_or_after inference, the RULES entry requiring missing_prevout, and the missing_parent evidence mode.
  • data/invalid-blocks.jsonl and blocks/474294-….bin, byte-identical to the copy in bitcoin-data/stale-blocks at 2633e0e. 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.md and docs/notes.md: the missing_prevout field, the evidence contract row, a section on why a later confirmation elsewhere proves the failure, and a plainer explanation of why ConnectBlock never runs when one of these blocks is replayed today.
  • Tests cover the confirmation height boundaries, the admission failures for a malformed or unspent outpoint, a non-canonical previous block and a missing cache, and that unconfirmed or malformed replies are never cached.

Testing

python ci/sanity-check.py --fetch-prevouts admits 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's prev_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.

@deadmanoz
deadmanoz marked this pull request as draft September 11, 2026 08:39
@deadmanoz
deadmanoz force-pushed the missing-unconfirmed-parent branch from ad2790c to c7d24f5 Compare September 11, 2026 08:40
@deadmanoz

deadmanoz commented Sep 11, 2026

Copy link
Copy Markdown
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
deadmanoz force-pushed the missing-unconfirmed-parent branch from c7d24f5 to 8e70c0b Compare September 11, 2026 08:51
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
deadmanoz force-pushed the missing-unconfirmed-parent branch from 8e70c0b to 2ed2222 Compare September 15, 2026 09:09
@deadmanoz deadmanoz changed the title Admit 1Hash block 474294 under a new omitted-parent-transaction rule Admit 1Hash block 474294 under a new missing-parent-transaction rule Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant