Skip to content

Commit

Permalink
Updated witness commitment logic
Browse files Browse the repository at this point in the history
  • Loading branch information
m-g-rathod committed May 6, 2024
1 parent f70ed3a commit 4e65e24
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Binary file modified __pycache__/validator.cpython-310.pyc
Binary file not shown.
6 changes: 2 additions & 4 deletions mine_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def gen_blk_hash(b_version, prev_b_hash, b_merkle_root, time_hex, bits, nonce):
total_wu += wu
total_fee += fee
high_fee_txn.append(sorted_valid_txn[i])
if len(wtxid) > 0:
wtxids.append(wtxid)

wtxids.append(wtxid)
txids.append(txid)
else:
break
Expand Down Expand Up @@ -81,7 +79,7 @@ def gen_blk_hash(b_version, prev_b_hash, b_merkle_root, time_hex, bits, nonce):
prev_b_hash_little = bytes.fromhex(prev_b_hash)[::-1].hex()
b_merkle_root = merkle_root(txids)
b_merkle_root_little = bytes.fromhex(b_merkle_root)[::-1].hex()
time = 1714992489
time = 1714993000
time_hex = time.to_bytes(4, byteorder='little').hex()
bits = "ffff001f"

Expand Down
6 changes: 3 additions & 3 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2000000000000000000000000000000000000000000000000000000000000000ffae0000a8e0c8ef2b970d5904455bf0b82bc88116fceb9b07384346c9d080042d85a69e69b53866ffff001f86d80300
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0f0e4d696e6564206279204d69686972000000000245805201000000001976a914cb4f45b4ecfe54b25106a919237cf34ce193c1b988ac0000000000000000266a24aa21a9ed78d8d7ea148f93ae086616eb3625f34236b4af5b78aea23b68d382ab6d10149a0120000000000000000000000000000000000000000000000000000000000000000000000000
93d5c7a4d0354695dd846c06b5dc19f4106d9fc6f738d6f84dea92b9dfb57b5d
2000000000000000000000000000000000000000000000000000000000000000ffae00006c9281ef2794a5d5827ed34e1f65a64daf6549a85b9ab75ed6afa553dcc8902a68b73866ffff001f91210100
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff0f0e4d696e6564206279204d69686972000000000245805201000000001976a914cb4f45b4ecfe54b25106a919237cf34ce193c1b988ac0000000000000000266a24aa21a9edddab664a68effdc70d8eaee7673f525b330b7ba6224e72cea724f0a2fca70fd60120000000000000000000000000000000000000000000000000000000000000000000000000
19e4e2b687facc93820df53ce5ba1326416a288bd37f606b11435ef072f0ffe3
4ab3cc4296fee78153d60d2884323a84260157db0b83a72309272f109ad9dd32
99bf982da397947eb0999292e909c17c78d884e18d3e59ac03fd2aa7f0241c7e
dcd522b3588c7adb0418454539e1a929fff936f211e5a20383fdcbc3ad8751b9
Expand Down
2 changes: 2 additions & 0 deletions validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,8 @@ def validate_script(script_list, stack, transaction, filename, ip):
if witness != "":
temp += version + "0001" + inputs + outputs + witness + locktime
wtxid = dsha256(temp)
else:
wtxid = txid

fee = input_value - output_value
fee_wu = fee // wu
Expand Down

0 comments on commit 4e65e24

Please sign in to comment.