bitcoin-util: print genesis hash in display order
What changed, and why it matters
This commit fixes a display bug in a command-line utility so that the Bitcoin genesis block hash is printed in the same byte order humans normally see it (big-endian), instead of the reversed internal storage order. It only changes output formatting and matching test data; it does not affect money, transactions, consensus rules, or network security.
No security action required; treat as a normal correctness/cosmetic fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In src/bitcoin-util.cpp, the GetChainParams helper previously serialized consensus.hashGenesisBlock with HexStr(), which emits the hash in little-endian/internal byte order. The patch switches to consensus.hashGenesisBlock.GetHex(), which returns the reversed, display-order representation used by block explorers and RPC. Corresponding functional-test JSON fixtures are updated to the display-order strings. This is a pure presentation-layer correction with no consensus, validation, or cryptographic impact.
Changed components
src/bitcoin-util.cpp (GetChainParams output formatting)test/functional/data/util/getchainparams-*.json (expected fixture strings)Inspect captured patch +7 / −7
### src/bitcoin-util.cpp
@@ -166,7 +166,7 @@ static int GetChainParams(const std::vector<std::string>& args, std::string& str
UniValue result{UniValue::VOBJ};
result.pushKV("chain", params.GetChainTypeString());
result.pushKV("test_chain", params.IsTestChain());
- result.pushKV("genesis", HexStr(consensus.hashGenesisBlock));
+ result.pushKV("genesis", consensus.hashGenesisBlock.GetHex());
result.pushKV("subsidy_halving_interval", consensus.nSubsidyHalvingInterval);
if (consensus.signet_blocks) {
### test/functional/data/util/getchainparams-mainnet.json
@@ -1,7 +1,7 @@
{
"chain": "main",
"test_chain": false,
- "genesis": "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000",
+ "genesis": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"subsidy_halving_interval": 210000,
"pow": {
"limit": "00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
### test/functional/data/util/getchainparams-regtest.json
@@ -1,7 +1,7 @@
{
"chain": "regtest",
"test_chain": true,
- "genesis": "06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f",
+ "genesis": "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206",
"subsidy_halving_interval": 150,
"pow": {
"limit": "7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
### test/functional/data/util/getchainparams-signet-custom.json
@@ -1,7 +1,7 @@
{
"chain": "signet",
"test_chain": true,
- "genesis": "f61eee3b63a380a477a063af32b2bbc97c9ff9f01f2c4225e973988108000000",
+ "genesis": "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6",
"subsidy_halving_interval": 210000,
"signet": {
"challenge": "512102f7561d208dd9ae99bf497273e16f389bdbd6c4742ddb8e6b216e64fa2928ad8f51ae"
### test/functional/data/util/getchainparams-signet.json
@@ -1,7 +1,7 @@
{
"chain": "signet",
"test_chain": true,
- "genesis": "f61eee3b63a380a477a063af32b2bbc97c9ff9f01f2c4225e973988108000000",
+ "genesis": "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6",
"subsidy_halving_interval": 210000,
"signet": {
"challenge": "512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae"
### test/functional/data/util/getchainparams-testnet.json
@@ -1,7 +1,7 @@
{
"chain": "test",
"test_chain": true,
- "genesis": "43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000",
+ "genesis": "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
"subsidy_halving_interval": 210000,
"pow": {
"limit": "00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
### test/functional/data/util/getchainparams-testnet4.json
@@ -1,7 +1,7 @@
{
"chain": "testnet4",
"test_chain": true,
- "genesis": "43f08bdab050e35b567c864b91f47f50ae725ae2de53bcfbbaf284da00000000",
+ "genesis": "00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043",
"subsidy_halving_interval": 210000,
"pow": {
"limit": "00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.