Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_utxo_set_hash.py
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | def test_muhash_implementation(self): | ||||
for height, block in enumerate(blocks): | for height, block in enumerate(blocks): | ||||
# The Genesis block coinbase is not part of the UTXO set and we | # The Genesis block coinbase is not part of the UTXO set and we | ||||
# spent the first mined block | # spent the first mined block | ||||
height += 2 | height += 2 | ||||
for tx in block.vtx: | for tx in block.vtx: | ||||
for n, tx_out in enumerate(tx.vout): | for n, tx_out in enumerate(tx.vout): | ||||
coinbase = 1 if not tx.vin[0].prevout.hash else 0 | coinbase = 1 if not tx.vin[0].prevout.txid else 0 | ||||
data = COutPoint(int(tx.rehash(), 16), n).serialize() | data = COutPoint(int(tx.rehash(), 16), n).serialize() | ||||
data += struct.pack("<i", height * 2 + coinbase) | data += struct.pack("<i", height * 2 + coinbase) | ||||
data += tx_out.serialize() | data += tx_out.serialize() | ||||
muhash.insert(data) | muhash.insert(data) | ||||
finalized = muhash.digest() | finalized = muhash.digest() | ||||
Show All 11 Lines |