Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1133: Allow signmessage to work with any index

f5c7f339d3 Allow signmessage to work with any index (Adam Gibson)

Pull request description:

  Fixes #1043.
  Prior to this commit, only keys/scripts/addresses
  inside the scope of the current wallet script_map
  (the keys cached by sync, according to persisted
  index in wallet file, including gap limit) would
  allow a successful signing operation, otherwise
  an assertion was raised.
  After this commit, signing can be done with any
  arbitrary height index in the wallet (assuming a
  valid path for this wallet).

ACKs for top commit:
  kristapsk:
    ACK f5c7f339d3

Tree-SHA512: bf057347d1c088217236b085562afefee10ecf8f2610a48b10439f0ed3f6bb00ab1b88917c9b29b7a3f265d0378286a7d687db0644f2a1e2134ff70ccec7d8e5
master
Kristaps Kaupe 4 years ago
parent
commit
dd09025d48
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 6
      jmclient/jmclient/wallet.py
  2. 3
      jmclient/jmclient/wallet_utils.py

6
jmclient/jmclient/wallet.py

@ -940,11 +940,13 @@ class BaseWallet(object):
args:
message: bytes
path: path tuple
returns:
returns as tuple:
address of key that signed
signature as base64-encoded string
"""
priv, engine = self._get_key_from_path(path)
return engine.sign_message(priv, message)
addr = engine.privkey_to_address(priv)
return addr, engine.sign_message(priv, message)
def get_wallet_name(self):
""" Returns the name used as a label for this

3
jmclient/jmclient/wallet_utils.py

@ -1117,8 +1117,7 @@ def wallet_signmessage(wallet, hdpath, message, out_str=True):
return "Error: no message specified"
path = wallet.path_repr_to_path(hdpath)
sig = wallet.sign_message(msg, path)
addr = wallet.get_address_from_path(path)
addr, sig = wallet.sign_message(msg, path)
if not out_str:
return (sig, message, addr)
return ("Signature: {}\nMessage: {}\nAddress: {}\n"

Loading…
Cancel
Save