Skip to content

Commit cb03368

Browse files
committed
scripted-diff: Rename hash_serialized_2 to hash_serialized_3
-BEGIN VERIFY SCRIPT- sed -i 's/hash_serialized_2/hash_serialized_3/g' $( git grep -l 'hash_serialized_2' ./src ./contrib ./test ) -END VERIFY SCRIPT-
1 parent 351370a commit cb03368

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

contrib/devtools/utxo_snapshot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ${BITCOIN_CLI_CALL} invalidateblock "${PIVOT_BLOCKHASH}"
3434

3535
if [[ "${OUTPUT_PATH}" = "-" ]]; then
3636
(>&2 echo "Generating txoutset info...")
37-
${BITCOIN_CLI_CALL} gettxoutsetinfo | grep hash_serialized_2 | sed 's/^.*: "\(.\+\)\+",/\1/g'
37+
${BITCOIN_CLI_CALL} gettxoutsetinfo | grep hash_serialized_3 | sed 's/^.*: "\(.\+\)\+",/\1/g'
3838
else
3939
(>&2 echo "Generating UTXO snapshot...")
4040
${BITCOIN_CLI_CALL} dumptxoutset "${OUTPUT_PATH}"

src/rpc/blockchain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ static RPCHelpMan pruneblockchain()
820820

821821
CoinStatsHashType ParseHashType(const std::string& hash_type_input)
822822
{
823-
if (hash_type_input == "hash_serialized_2") {
823+
if (hash_type_input == "hash_serialized_3") {
824824
return CoinStatsHashType::HASH_SERIALIZED;
825825
} else if (hash_type_input == "muhash") {
826826
return CoinStatsHashType::MUHASH;
@@ -867,7 +867,7 @@ static RPCHelpMan gettxoutsetinfo()
867867
"\nReturns statistics about the unspent transaction output set.\n"
868868
"Note this call may take some time if you are not using coinstatsindex.\n",
869869
{
870-
{"hash_type", RPCArg::Type::STR, RPCArg::Default{"hash_serialized_2"}, "Which UTXO set hash should be calculated. Options: 'hash_serialized_2' (the legacy algorithm), 'muhash', 'none'."},
870+
{"hash_type", RPCArg::Type::STR, RPCArg::Default{"hash_serialized_3"}, "Which UTXO set hash should be calculated. Options: 'hash_serialized_3' (the legacy algorithm), 'muhash', 'none'."},
871871
{"hash_or_height", RPCArg::Type::NUM, RPCArg::DefaultHint{"the current best block"}, "The block hash or height of the target height (only available with coinstatsindex).",
872872
RPCArgOptions{
873873
.skip_type_check = true,
@@ -882,7 +882,7 @@ static RPCHelpMan gettxoutsetinfo()
882882
{RPCResult::Type::STR_HEX, "bestblock", "The hash of the block at which these statistics are calculated"},
883883
{RPCResult::Type::NUM, "txouts", "The number of unspent transaction outputs"},
884884
{RPCResult::Type::NUM, "bogosize", "Database-independent, meaningless metric indicating the UTXO set size"},
885-
{RPCResult::Type::STR_HEX, "hash_serialized_2", /*optional=*/true, "The serialized hash (only present if 'hash_serialized_2' hash_type is chosen)"},
885+
{RPCResult::Type::STR_HEX, "hash_serialized_3", /*optional=*/true, "The serialized hash (only present if 'hash_serialized_3' hash_type is chosen)"},
886886
{RPCResult::Type::STR_HEX, "muhash", /*optional=*/true, "The serialized hash (only present if 'muhash' hash_type is chosen)"},
887887
{RPCResult::Type::NUM, "transactions", /*optional=*/true, "The number of transactions with unspent outputs (not available when coinstatsindex is used)"},
888888
{RPCResult::Type::NUM, "disk_size", /*optional=*/true, "The estimated size of the chainstate on disk (not available when coinstatsindex is used)"},
@@ -942,7 +942,7 @@ static RPCHelpMan gettxoutsetinfo()
942942
}
943943

944944
if (hash_type == CoinStatsHashType::HASH_SERIALIZED) {
945-
throw JSONRPCError(RPC_INVALID_PARAMETER, "hash_serialized_2 hash type cannot be queried for a specific block");
945+
throw JSONRPCError(RPC_INVALID_PARAMETER, "hash_serialized_3 hash type cannot be queried for a specific block");
946946
}
947947

948948
if (!index_requested) {
@@ -971,7 +971,7 @@ static RPCHelpMan gettxoutsetinfo()
971971
ret.pushKV("txouts", (int64_t)stats.nTransactionOutputs);
972972
ret.pushKV("bogosize", (int64_t)stats.nBogoSize);
973973
if (hash_type == CoinStatsHashType::HASH_SERIALIZED) {
974-
ret.pushKV("hash_serialized_2", stats.hashSerialized.GetHex());
974+
ret.pushKV("hash_serialized_3", stats.hashSerialized.GetHex());
975975
}
976976
if (hash_type == CoinStatsHashType::MUHASH) {
977977
ret.pushKV("muhash", stats.hashSerialized.GetHex());

test/functional/feature_coinstatsindex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,11 @@ def _test_reorg_index(self):
293293
def _test_index_rejects_hash_serialized(self):
294294
self.log.info("Test that the rpc raises if the legacy hash is passed with the index")
295295

296-
msg = "hash_serialized_2 hash type cannot be queried for a specific block"
297-
assert_raises_rpc_error(-8, msg, self.nodes[1].gettxoutsetinfo, hash_type='hash_serialized_2', hash_or_height=111)
296+
msg = "hash_serialized_3 hash type cannot be queried for a specific block"
297+
assert_raises_rpc_error(-8, msg, self.nodes[1].gettxoutsetinfo, hash_type='hash_serialized_3', hash_or_height=111)
298298

299299
for use_index in {True, False, None}:
300-
assert_raises_rpc_error(-8, msg, self.nodes[1].gettxoutsetinfo, hash_type='hash_serialized_2', hash_or_height=111, use_index=use_index)
300+
assert_raises_rpc_error(-8, msg, self.nodes[1].gettxoutsetinfo, hash_type='hash_serialized_3', hash_or_height=111, use_index=use_index)
301301

302302
def _test_init_index_after_reorg(self):
303303
self.log.info("Test a reorg while the index is deactivated")

test/functional/feature_dbcrash.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def restart_node(self, node_index, expected_tip):
8585
# Any of these RPC calls could throw due to node crash
8686
self.start_node(node_index)
8787
self.nodes[node_index].waitforblock(expected_tip)
88-
utxo_hash = self.nodes[node_index].gettxoutsetinfo()['hash_serialized_2']
88+
utxo_hash = self.nodes[node_index].gettxoutsetinfo()['hash_serialized_3']
8989
return utxo_hash
9090
except Exception:
9191
# An exception here should mean the node is about to crash.
@@ -130,7 +130,7 @@ def sync_node3blocks(self, block_hashes):
130130
If any nodes crash while updating, we'll compare utxo hashes to
131131
ensure recovery was successful."""
132132

133-
node3_utxo_hash = self.nodes[3].gettxoutsetinfo()['hash_serialized_2']
133+
node3_utxo_hash = self.nodes[3].gettxoutsetinfo()['hash_serialized_3']
134134

135135
# Retrieve all the blocks from node3
136136
blocks = []
@@ -172,12 +172,12 @@ def verify_utxo_hash(self):
172172
"""Verify that the utxo hash of each node matches node3.
173173
174174
Restart any nodes that crash while querying."""
175-
node3_utxo_hash = self.nodes[3].gettxoutsetinfo()['hash_serialized_2']
175+
node3_utxo_hash = self.nodes[3].gettxoutsetinfo()['hash_serialized_3']
176176
self.log.info("Verifying utxo hash matches for all nodes")
177177

178178
for i in range(3):
179179
try:
180-
nodei_utxo_hash = self.nodes[i].gettxoutsetinfo()['hash_serialized_2']
180+
nodei_utxo_hash = self.nodes[i].gettxoutsetinfo()['hash_serialized_3']
181181
except OSError:
182182
# probably a crash on db flushing
183183
nodei_utxo_hash = self.restart_node(i, self.nodes[3].getbestblockhash())

test/functional/feature_utxo_set_hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_muhash_implementation(self):
6969
assert_equal(finalized[::-1].hex(), node_muhash)
7070

7171
self.log.info("Test deterministic UTXO set hash results")
72-
assert_equal(node.gettxoutsetinfo()['hash_serialized_2'], "d1c7fec1c0623f6793839878cbe2a531eb968b50b27edd6e2a57077a5aed6094")
72+
assert_equal(node.gettxoutsetinfo()['hash_serialized_3'], "d1c7fec1c0623f6793839878cbe2a531eb968b50b27edd6e2a57077a5aed6094")
7373
assert_equal(node.gettxoutsetinfo("muhash")['muhash'], "d1725b2fe3ef43e55aa4907480aea98d406fc9e0bf8f60169e2305f1fbf5961b")
7474

7575
def run_test(self):

test/functional/rpc_blockchain.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def _test_gettxoutsetinfo(self):
340340
assert size > 6400
341341
assert size < 64000
342342
assert_equal(len(res['bestblock']), 64)
343-
assert_equal(len(res['hash_serialized_2']), 64)
343+
assert_equal(len(res['hash_serialized_3']), 64)
344344

345345
self.log.info("Test gettxoutsetinfo works for blockchain with just the genesis block")
346346
b1hash = node.getblockhash(1)
@@ -353,7 +353,7 @@ def _test_gettxoutsetinfo(self):
353353
assert_equal(res2['txouts'], 0)
354354
assert_equal(res2['bogosize'], 0),
355355
assert_equal(res2['bestblock'], node.getblockhash(0))
356-
assert_equal(len(res2['hash_serialized_2']), 64)
356+
assert_equal(len(res2['hash_serialized_3']), 64)
357357

358358
self.log.info("Test gettxoutsetinfo returns the same result after invalidate/reconsider block")
359359
node.reconsiderblock(b1hash)
@@ -365,20 +365,20 @@ def _test_gettxoutsetinfo(self):
365365
assert_equal(res, res3)
366366

367367
self.log.info("Test gettxoutsetinfo hash_type option")
368-
# Adding hash_type 'hash_serialized_2', which is the default, should
368+
# Adding hash_type 'hash_serialized_3', which is the default, should
369369
# not change the result.
370-
res4 = node.gettxoutsetinfo(hash_type='hash_serialized_2')
370+
res4 = node.gettxoutsetinfo(hash_type='hash_serialized_3')
371371
del res4['disk_size']
372372
assert_equal(res, res4)
373373

374374
# hash_type none should not return a UTXO set hash.
375375
res5 = node.gettxoutsetinfo(hash_type='none')
376-
assert 'hash_serialized_2' not in res5
376+
assert 'hash_serialized_3' not in res5
377377

378378
# hash_type muhash should return a different UTXO set hash.
379379
res6 = node.gettxoutsetinfo(hash_type='muhash')
380380
assert 'muhash' in res6
381-
assert res['hash_serialized_2'] != res6['muhash']
381+
assert res['hash_serialized_3'] != res6['muhash']
382382

383383
# muhash should not be returned unless requested.
384384
for r in [res, res2, res3, res4, res5]:

0 commit comments

Comments
 (0)