fix: stop UpdateStatus from wiping block_hash#25
Merged
Conversation
UpdateStatus unconditionally set block_hash on every status change. No caller ever passed a BlockHash, so it always wrote NULL — wiping the value that SetMinedByBlockHash had correctly set. This broke the GetStatus JOIN to merkle_paths for every tx that transitioned from MINED to IMMUTABLE, and also prevented the reorg handler from finding those txs by block_hash to reset them. Remove block_hash from UpdateStatus SQL since it is managed exclusively by SetMinedByBlockHash (sets it) and SetStatusByBlockHash (clears it on reorgs). Add migration 3 to repopulate wiped block_hash values from merkle_paths joined through processed_blocks (canonical chain only). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
galt-tr
approved these changes
Feb 24, 2026
Contributor
galt-tr
left a comment
There was a problem hiding this comment.
LGTM. nancy check is failing but unrelated to this
sirdeggen
approved these changes
Feb 24, 2026
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
UpdateStatusunconditionally setblock_hashon every status change, but no caller ever passed aBlockHash— so it always wrote NULL, wiping the value thatSetMinedByBlockHashhad correctly setGetStatusJOIN tomerkle_pathsfor every tx that transitioned MINED → IMMUTABLE (152 of 156 mined txs on a test instance)SetStatusByBlockHash) from finding txs byblock_hashto reset them, leaving orphaned txs stuck as IMMUTABLEblock_hashfromUpdateStatusSQL — it's managed exclusively bySetMinedByBlockHash(sets it) andSetStatusByBlockHash(clears on reorgs)block_hashvalues frommerkle_pathsjoined throughprocessed_blocks(canonical chain only)Test plan
GetStatusreturnsblock_heightandmerkle_pathfor IMMUTABLE transactions after migrationblock_hash🤖 Generated with Claude Code