Skip to content

Commit

Permalink
Minor fixes in txn serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
m-g-rathod committed May 6, 2024
1 parent 7fe7d2b commit fb768b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Binary file modified __pycache__/validator.cpython-310.pyc
Binary file not shown.
8 changes: 4 additions & 4 deletions output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
2000000000000000000000000000000000000000000000000000000000000000ffae000043767bcb8b59d2f6a37372381087b3b767bb6d9fe25867f7b2d79ba94cc4050586963866ffff001fa22b0000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff00000000000245805201000000001976a914cb4f45b4ecfe54b25106a919237cf34ce193c1b988ac0000000000000000266a24aa21a9ed2a8c05a37101641b8c1b579dc23df9847f75954ce4e4329ff1d2fcffd70d995b0120000000000000000000000000000000000000000000000000000000000000000000000000
7126789d60979ff28fe141bcab6b281f50741fecf77ed8aaa0cfa04e84393f9d
2000000000000000000000000000000000000000000000000000000000000000ffae000016260e29a2f4e3d1563fff58ec25018ac721701e190f1e47ccc8b63254f39d3c86963866ffff001f4c710000
010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff00000000000245805201000000001976a914cb4f45b4ecfe54b25106a919237cf34ce193c1b988ac0000000000000000266a24aa21a9ed78d8d7ea148f93ae086616eb3625f34236b4af5b78aea23b68d382ab6d10149a0120000000000000000000000000000000000000000000000000000000000000000000000000
6cc5d0584238cf498eaeb887da43d1e756fa767f8ffbddd485823173ae6cdd6c
4ab3cc4296fee78153d60d2884323a84260157db0b83a72309272f109ad9dd32
99bf982da397947eb0999292e909c17c78d884e18d3e59ac03fd2aa7f0241c7e
dcd522b3588c7adb0418454539e1a929fff936f211e5a20383fdcbc3ad8751b9
Expand Down Expand Up @@ -1970,7 +1970,7 @@ d10c32a5d1137338367c32454990e4b98f6f1a09d82340327d6910eab6b75e85
f85c4454ed5f92e088dbc2fe712152bf4c11c58b935d9d1f9d013e28c466e23e
99b139a1bfa3b50973c882be74108261f201cbc20696f1aca4dda3547fb83628
9acbca60437a52735c17a2f6642bbab45a5fc2248d19dcb7e3a61ad061e246ef
07d1b6299385527afcc26e522ca31fd396eaf8673075aa183ecae6de91008c7b
8b4f92382384d833c560b0934d031fd3a55d1cb867a6212c4b3d31586360b2a5
b9264d8578ef6bad18c4b8d2fc63abdc4202af2b0d932e6b0f867239b072e32f
905514727f24de3b3bdf37701954a3915824290e12561ce42960ff0733a28b84
c4fca7284be57bdf4caa683c351f214654c137bacaf7bd0a6cfa966f605a7cee
Expand Down
18 changes: 9 additions & 9 deletions validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ def validate_script(script_list, stack, transaction, filename, ip):
if op_len <= 252:
outputs += op_len.to_bytes(1, byteorder='little').hex()
elif 253 <= op_len <= 65535:
inputs += "fd"
outputs += "fd"
outputs += op_len.to_bytes(2, byteorder='little').hex()
elif 65536 <= op_len <= 4294967295:
outputs += "fe"
Expand Down Expand Up @@ -958,11 +958,11 @@ def validate_script(script_list, stack, transaction, filename, ip):
witness += "fd"
witness += witness_stack_len.to_bytes(2, byteorder='little').hex()
elif 65536 <= witness_stack_len <= 4294967295:
inputs += "fe"
inputs += witness_stack_len.to_bytes(4, byteorder='little').hex()
witness += "fe"
witness += witness_stack_len.to_bytes(4, byteorder='little').hex()
else:
inputs += "ff"
inputs += witness_stack_len.to_bytes(8, byteorder='little').hex()
witness += "ff"
witness += witness_stack_len.to_bytes(8, byteorder='little').hex()

for item in ip['witness']:
if item == "":
Expand All @@ -975,11 +975,11 @@ def validate_script(script_list, stack, transaction, filename, ip):
witness += "fd"
witness += item_len.to_bytes(2, byteorder='little').hex()
elif 65536 <= item_len <= 4294967295:
inputs += "fe"
inputs += item_len.to_bytes(4, byteorder='little').hex()
witness += "fe"
witness += item_len.to_bytes(4, byteorder='little').hex()
else:
inputs += "ff"
inputs += item_len.to_bytes(8, byteorder='little').hex()
witness += "ff"
witness += item_len.to_bytes(8, byteorder='little').hex()

witness += item

Expand Down

0 comments on commit fb768b7

Please sign in to comment.