@@ -87,7 +87,7 @@ def sender(self):
87
87
pk .public_key = pk .ecdsa_recover (
88
88
rawhash ,
89
89
pk .ecdsa_recoverable_deserialize (
90
- zpad ("" . join ( chr ( c ) for c in int_to_32bytearray (self .r )), 32 ) + zpad ("" . join ( chr ( c ) for c in int_to_32bytearray (self .s )), 32 ),
90
+ zpad (utils . bytearray_to_bytestr ( int_to_32bytearray (self .r )), 32 ) + zpad (utils . bytearray_to_bytestr ( int_to_32bytearray (self .s )), 32 ),
91
91
self .v - 27
92
92
),
93
93
raw = True
@@ -96,7 +96,7 @@ def sender(self):
96
96
except Exception :
97
97
raise InvalidTransaction ("Invalid signature values (x^3+7 is non-residue)" )
98
98
99
- if pub [1 :] == "\x00 " * 32 :
99
+ if pub [1 :] == b "\x00 " * 32 :
100
100
raise InvalidTransaction ("Invalid signature (zero privkey cannot sign)" )
101
101
pub = encode_pubkey (pub , 'bin' )
102
102
self ._sender = utils .sha3 (pub [1 :])[- 20 :]
@@ -114,7 +114,7 @@ def sign(self, key):
114
114
115
115
A potentially already existing signature would be overridden.
116
116
"""
117
- if key in (0 , '' , '\x00 ' * 32 , '0' * 64 ):
117
+ if key in (0 , '' , b '\x00 ' * 32 , '0' * 64 ):
118
118
raise InvalidTransaction ("Zero privkey cannot sign" )
119
119
rawhash = utils .sha3 (rlp .encode (self , UnsignedTransaction ))
120
120
@@ -126,8 +126,8 @@ def sign(self, key):
126
126
signature = pk .ecdsa_recoverable_serialize (
127
127
pk .ecdsa_sign_recoverable (rawhash , raw = True )
128
128
)
129
- signature = signature [0 ] + chr ( signature [1 ])
130
- self .v = ord (signature [64 ]) + 27
129
+ signature = signature [0 ] + utils . bytearray_to_bytestr ([ signature [1 ] ])
130
+ self .v = utils . safe_ord (signature [64 ]) + 27
131
131
self .r = big_endian_to_int (signature [0 :32 ])
132
132
self .s = big_endian_to_int (signature [32 :64 ])
133
133
0 commit comments