One tree, one active state

Blocks records accepted branches. UTXO belongs to exactly Tip.

Prediction: can a stored sibling spend an output missing at the active tip? Yes, if it exists at that sibling's parent.

1 / 6

Follow work, use height for ancestry

G(1) → A(2) → C(2) totals 5. G(1) → B(3) → D(2) totals 6.

D wins; G is the fork. Equal work retains the current tip. Here reorg=true also includes an ordinary extension.

2 / 6

Reconstruct the transition

Active {c:35} → undo C {a:40} → undo A {g:50} → apply B {b:45} → apply D {d:42}.

Why not apply D first? Its input b is not present yet. The common ancestor is never disconnected.

3 / 6

Undo must restore the pre-block state

Inside one block: g → x → y.

Final {y}; after rollback {g}. Restoring every consumed input would incorrectly resurrect x. Save only consumed outputs that predate the block.

4 / 6

Reject atomically

Candidate transaction 1 succeeds; transaction 2 spends an unknown output.

Do all work on a private parent view. On failure, discard it. On success, store metadata; publish UTXO and tip only if the candidate wins. Never leave a rejected ID in the accepted-block map.

5 / 6

Boundary check

Known valid ID: no-op. Unknown parent: reject. Work overflow: reject.

This is in-memory validation, not crash recovery or full Bitcoin consensus. Explain why changing only Tip cannot repair a partially mutated UTXO map.

6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen