We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e872989 commit 542ac35Copy full SHA for 542ac35
1 file changed
bitcoin/wallet.py
@@ -17,11 +17,14 @@
17
18
from __future__ import absolute_import, division, print_function, unicode_literals
19
20
+import array
21
import sys
22
23
_bord = ord
24
+_tobytes = lambda x: array.array('B', x).tostring()
25
if sys.version > '3':
26
_bord = lambda x: x
27
+ _tobytes = bytes
28
29
import bitcoin
30
import bitcoin.base58
@@ -72,9 +75,11 @@ class CBech32BitcoinAddress(bitcoin.bech32.CBech32Data, CBitcoinAddress):
72
75
@classmethod
73
76
def from_bytes(cls, witver, witprog):
74
77
- assert(witver == 0)
-
- self = super(CBech32BitcoinAddress, cls).from_bytes(witver, witprog)
78
+ assert witver == 0
79
+ self = super(CBech32BitcoinAddress, cls).from_bytes(
80
+ witver,
81
+ _tobytes(witprog)
82
+ )
83
84
if len(self) == 32:
85
self.__class__ = P2WSHBitcoinAddress
0 commit comments