Skip to content

Commit

Permalink
witness commitment issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudarshan-21 committed May 1, 2024
1 parent 8172226 commit b0ac68a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def wit_serialize_transaction(transactions):
tx_data += little_endian_bytes(locktime, 4)
wtxid_hash = hashlib.sha256(hashlib.sha256(tx_data).digest()).digest()

wtxid_array.append(wtxid_hash[::-1].hex())
wtxid_array.append(wtxid_hash.hex())

return wtxid_array, tx_data.hex(), wtxid_hash.hex(), wtxid_hash[::-1].hex()

Expand Down Expand Up @@ -308,7 +308,7 @@ def serialize_coinbase(transactions):
# Append txid, prev_tx_out_index, scriptsig
tx_data += (
txid +
little_endian_bytes(prev_tx_out_index, 4) +
prev_tx_out_index +
varint_encode(len(scriptsig)) +
scriptsig +
little_endian_bytes(sequence, 4)
Expand Down Expand Up @@ -372,7 +372,7 @@ def create_coinbase(wTXID_commit, block_Height):
"vin": [
{
"txid": "0000000000000000000000000000000000000000000000000000000000000000",
"vout": 1,
"vout": "ffffffff",
"prevout": {
"scriptpubkey": "001481897cd2113b1b0bf0e718cc791d9bd2d246c555",
"scriptpubkey_asm": "OP_0 OP_PUSHBYTES_20 81897cd2113b1b0bf0e718cc791d9bd2d246c555",
Expand Down
6 changes: 3 additions & 3 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
0000000400000000000000000000000000000000000000000000000000000000000000008c051b53b1757da1a8a95187859407be04628aa5bb8af20e960f92bef142b7741c873166ffff001f0ba60300
020000000001010000000000000000000000000000000000000000000000000000000000000000010000000d03951a0610076c0000946e010000000000020000000000000000266a24aa21a9ed1ef5192773bb609ffbddfcb41c128963d584af8e9cc2fab9f1c756cf3724e74a00000000000000001976a914acd783f632ad040fc72d9a06ec17ffb2d8a97a5d88ac0120000000000000000000000000000000000000000000000000000000000000000000000000
331a3ba420228f74a3f2a456bfffb7f0ac6ecd394c43df733e5b1ade235298a0
000000040000000000000000000000000000000000000000000000000000000000000000bc7dde09b014584f1a2ba5560208114166aa61093226403f2226f0da4d20efcdca8a3166ffff001f70200400
020000000001010000000000000000000000000000000000000000000000000000000000000000010000000d03951a0610076c0000946e010000000000020000000000000000266a24aa21a9edf6580126b35b7a224becbbcd11a23f72f4b9edfb68383bc268a42f972cd57b6d00000000000000001976a914acd783f632ad040fc72d9a06ec17ffb2d8a97a5d88ac0120000000000000000000000000000000000000000000000000000000000000000000000000
c4e91e60870c1ffa9c29b1153683ac928f4cb30e73e44bbc33e4b016ee858e9d
25ce6b8d39d02471c43a804569a72015e81f3400170c1b8f5418e6938cd60b74
34845a0f5eca756d7768ee2f03186ec4d73d86f9ebeaaf96abddf8bb733641b6
93bba324688af65b727f0c9c08f0fb45e2a2389b269939b1414f4818b071c598
Expand Down

0 comments on commit b0ac68a

Please sign in to comment.