Commit 1a089d6
committed
Merge #159: Fix struct.unpack receiving an integer instead of a byte
81ca8a3 Fix struct.unpack receiving an integer instead of a byte. stackoverflow.com/q/29299136/ (David)
Pull request description:
Fix struct.unpack receiving an integer instead of a byte.
Before I was receiving this error
```
File "/python-bitcoinlib/venv/lib/python3.6/site-packages/python_bitcoinlib-0.9.0-py3.6.egg/bitcoin/core/script.py", line 684, in is_witness_scriptpubkey
return 3 <= len(self) <= 42 and CScriptOp(struct.unpack('<b',self[0])[0]).is_small_int()
TypeError: a bytes-like object is required, not 'int'
```
Solved by getting the byte with self[0:1]. A bytearray of length 1 that is accepted by unpack.
Check https://stackoverflow.com/q/29299136/
Tree-SHA512: 968d4b864baa820bb80f12b24031dbb9166aa3f46f612bb0f393eb5d445a869271591d100cebad528e3263079158e7a6bd7d565803b86e568b01223b55aa6f4a1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
683 | | - | |
| 683 | + | |
684 | 684 | | |
685 | 685 | | |
686 | 686 | | |
| |||
0 commit comments