Avoid empty nonce string from tx

This commit is contained in:
nolash
2021-01-12 14:50:52 +01:00
parent d07fc6c767
commit 468dd65462
5 changed files with 39 additions and 11 deletions

View File

@@ -34,7 +34,10 @@ class ReferenceSigner(Signer):
g = h.digest()
k = keys.PrivateKey(self.keyGetter.get(tx.sender, password))
z = keys.ecdsa_sign(message_hash=g, private_key=k)
tx.v = (tx.v * 2) + 35 + z[64]
vnum = int.from_bytes(tx.v, 'big')
v = (vnum * 2) + 35 + z[64]
byts = ((v.bit_length()-1)/8)+1
tx.v = v.to_bytes(int(byts), 'big')
tx.r = z[:32]
tx.s = z[32:64]
return z