fix: use UTXO state root in block producer#2076
Merged
Scottcjn merged 1 commit intoScottcjn:mainfrom Apr 5, 2026
Merged
Conversation
|
Good catch! This fix addresses an important issue. The approach looks correct. |
|
Great fix! The change to use Code Quality:
Suggestions:
Overall LGTM! ✅ |
Owner
|
Reviewed. Block producer now uses UTXO Merkle state root when Payment: 50 RTC (Medium-High — consensus state root integrity) Thank you @createkr. |
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
BlockProducer.get_state_root()currently commits the legacy account-modelbalancesroot even when the node is operating against the UTXO database. This patch letsBlockProducerpreferutxo_db.compute_state_root()whenever a UTXO handle is available, while preserving the legacy balances-table path as a fallback.What changed
utxo_dbhandle toBlockProducerget_state_root()whenutxo_dbis attachedValidation
PYTHONPATH=node python3 -m py_compile node/rustchain_block_producer.py node/test_block_producer_state_root.py node/utxo_db.pyPYTHONPATH=node python3 node/test_block_producer_state_root.pyReviewer note
The semantic change is intentionally small (constructor wiring +
get_state_root()preference/fallback logic + focused tests). If GitHub shows the Python file as a large diff, that is due to repository line-ending normalization noise around this file history rather than broad logic churn.