Skip to content

Commit

Permalink
RPA nits
Browse files Browse the repository at this point in the history
  • Loading branch information
fyookball committed Oct 2, 2020
1 parent 4014626 commit 35e621f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/schnorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def sign(privkey, message_hash, *, ndata=None):
message) you want to sign
'''

if not ndata is None:
if ndata is not None:
assert len(bytearray(ndata)) == 32

if not isinstance(privkey, bytes) or len(privkey) != 32:
Expand All @@ -151,14 +151,14 @@ def sign(privkey, message_hash, *, ndata=None):
# just leave it as a vague exception.
raise ValueError('could not sign')
return bytes(sig)
else:
else:
# pure python fallback:
G = ecdsa.SECP256k1.generator
order = G.order()
fieldsize = G.curve().p()

# For pure python (not libsecp256k1), convert an empty ndata to bytes as the required format for concatenation inside the nonce function.
if ndata == None:
if ndata is None:
ndata = b''

secexp = int.from_bytes(privkey, 'big')
Expand Down
2 changes: 1 addition & 1 deletion lib/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def is_schnorr_signed(self, input_idx):
for sig in self._inputs[input_idx].get('signatures', []))
return False

def rpa_paycode_swap_dummy_for_destination(self,rpa_dummy_address, rpa_destination_address):
def rpa_paycode_swap_dummy_for_destination(self, rpa_dummy_address, rpa_destination_address):
# This method was created for RPA - reusable payment address.
# It swaps out a dummy destination address for the rpa-generated address.
# WARNING: This is not recommended for use outside of RPA since it could
Expand Down

0 comments on commit 35e621f

Please sign in to comment.