1
0

keystore.sign_message: add optional script_type argument

this is used by trezor
(and also by bitbox02, which was using a workaround previously)

fixes https://github.com/spesmilo/electrum/issues/7670
This commit is contained in:
SomberNight
2022-02-22 19:20:03 +01:00
parent 6603359c20
commit 376fc01b27
11 changed files with 37 additions and 21 deletions

View File

@@ -228,7 +228,7 @@ class TrezorClientBase(HardwareClientBase, Logger):
multisig=multisig)
@runs_in_hwd_thread
def sign_message(self, address_str, message):
def sign_message(self, address_str, message, *, script_type):
coin_name = self.plugin.get_coin_name()
address_n = parse_path(address_str)
with self.run_flow():
@@ -236,7 +236,9 @@ class TrezorClientBase(HardwareClientBase, Logger):
self.client,
coin_name,
address_n,
message)
message,
script_type=script_type,
no_script_type=True)
@runs_in_hwd_thread
def recover_device(self, recovery_type, *args, **kwargs):

View File

@@ -77,10 +77,11 @@ class TrezorKeyStore(Hardware_KeyStore):
def decrypt_message(self, sequence, message, password):
raise UserFacingException(_('Encryption and decryption are not implemented by {}').format(self.device))
def sign_message(self, sequence, message, password):
def sign_message(self, sequence, message, password, *, script_type=None):
client = self.get_client()
address_path = self.get_derivation_prefix() + "/%d/%d"%sequence
msg_sig = client.sign_message(address_path, message)
script_type = self.plugin.get_trezor_input_script_type(script_type)
msg_sig = client.sign_message(address_path, message, script_type=script_type)
return msg_sig.signature
def sign_transaction(self, tx, password):