From 9caaa7a8aa04ce1dc250deaa63ceadbdb49e5683 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 27 Oct 2024 01:59:12 +0400 Subject: [PATCH] Fix feature_utxo_set_hash.py --- test/functional/feature_utxo_set_hash.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/functional/feature_utxo_set_hash.py b/test/functional/feature_utxo_set_hash.py index a662daee0b..cb46eae6a9 100755 --- a/test/functional/feature_utxo_set_hash.py +++ b/test/functional/feature_utxo_set_hash.py @@ -51,25 +51,26 @@ def test_muhash_implementation(self): for tx in block.vtx: for n, tx_out in enumerate(tx.vout): coinbase = 1 if not tx.vin[0].prevout.hash else 0 + coinstake = 1 if not coinbase and (len(tx.vout) > 1 and tx.vout[1].nValue == 0) else 0 # Skip witness commitment if (coinbase and n > 0): continue data = COutPoint(int(tx.rehash(), 16), n).serialize() - data += (height * 2 + coinbase).to_bytes(4, "little") + data += ((height << 2) + (1 if coinbase else 0) + (2 if coinstake else 0)).to_bytes(4, "little") data += tx_out.serialize() muhash.insert(data) finalized = muhash.digest() node_muhash = node.gettxoutsetinfo("muhash")['muhash'] - + assert_equal(finalized[::-1].hex(), node_muhash) self.log.info("Test deterministic UTXO set hash results") - assert_equal(node.gettxoutsetinfo()['hash_serialized_3'], "c7e78ab6b073b92e81ccf19a81aa999f979e39c140d5452a22f6410d8bc79080") - assert_equal(node.gettxoutsetinfo("muhash")['muhash'], "6e8cb792ac86331ee314a7ab1b7d1e89c187d8630569b1625e0802f90876db1a") + assert_equal(node.gettxoutsetinfo()['hash_serialized_3'], "57ee83d6bcbb8991f07475b91a622ea6b6ad6982e51b7d66bceadd5af4b92a61") + assert_equal(node.gettxoutsetinfo("muhash")['muhash'], "10cc4181950ea01d90c7e13e80bb7e6a8c9b4baf0cde12f356f4af1d56594306") def run_test(self): self.test_muhash_implementation()