Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for bytearray bug on multiple transactions operations. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OP_RETURN.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ def OP_RETURN_create_txn(inputs, outputs, metadata, metadata_pos, testnet):
if metadata_len<=75:
payload=bytearray((metadata_len,))+metadata # length byte + data (https://en.bitcoin.it/wiki/Script)
elif metadata_len<=256:
payload="\x4c"+bytearray((metadata_len,))+metadata # OP_PUSHDATA1 format
payload=b"\x4c"+bytearray((metadata_len,))+metadata # OP_PUSHDATA1 format
else:
payload="\x4d"+bytearray((metadata_len%256,))+bytearray((int(metadata_len/256),))+metadata # OP_PUSHDATA2 format
payload=b"\x4d"+bytearray((metadata_len%256,))+bytearray((int(metadata_len/256),))+metadata # OP_PUSHDATA2 format

metadata_pos=min(max(0, metadata_pos), len(txn_unpacked['vout'])) # constrain to valid values

Expand Down