Skip to content

Commit

Permalink
Fix feature_utxo_set_hash.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil committed Oct 26, 2024
1 parent ffc0eae commit 9caaa7a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/functional/feature_utxo_set_hash.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9caaa7a

Please sign in to comment.