-
Notifications
You must be signed in to change notification settings - Fork 201
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
Issue inside 'as_dict()' in transactions.py #329
Comments
bitcoinlib 0.6.11 |
def as_dict(self):
|
The problem is not with the hex() method, the self.public_key should be always in bytes format. |
When the input of the transaction is P2PK, transactions.py#L1193 will be entered and the public_hex in the script is assigned to self.public_key. The value type here is str type. This problem can be solved by adding a to_bytes function on the right side of the equation. from bitcoinlib.transactions import Transaction
t = Transaction.parse_hex('01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff07044c86041b0146ffffffff0100f2052a01000000434104e18f7afbe4721580e81e8414fc8c24d7cfacf254bb5c7b949450c3e997c2dc1242487a8169507b631eb3771f2b425483fb13102c4eb5d858eef260fe70fbfae0ac00000000')
t.as_dict() |
Thanks, fixed in commit ae354c9 |
I am trying to use bitcoinlib to parse transactions and found problem inside transactions.py file
in function as_dict(), where by return of public_key is this error:
/lib/python3.10/site-packages/bitcoinlib/transactions.py", line 1346, in as_dict
'public_key': self.public_key.hex(),
AttributeError: 'str' object has no attribute 'hex'
I think it should be without .hex(), but I am not 100% sure about.
The text was updated successfully, but these errors were encountered: