QMessageBox.information(self.window,_('Error'),_("This wallet does not match your BTChip device"),_('OK'))
self.wallet.force_watching_only=True
else:
QMessageBox.information(self.window,_('Error'),_("BTChip device not detected.\nContinuing in watching-only mode."),_('OK'))
self.wallet.force_watching_only=True
@hook
definstallwizard_restore(self,wizard,storage):
ifstorage.get('wallet_type')!='btchip':
@ -98,16 +111,18 @@ class Plugin(BasePlugin):
exceptExceptionase:
tx.error=str(e)
classBTChipWallet(NewWallet):
classBTChipWallet(BIP32_HD_Wallet):
wallet_type='btchip'
root_derivation="m/44'/0'"
def__init__(self,storage):
NewWallet.__init__(self,storage)
BIP32_HD_Wallet.__init__(self,storage)
self.transport=None
self.client=None
self.mpk=None
self.device_checked=False
self.signing=False
self.force_watching_only=False
defgive_error(self,message,clear_client=False):
ifnotself.signing:
@ -129,11 +144,8 @@ class BTChipWallet(NewWallet):
defcan_change_password(self):
returnFalse
defhas_seed(self):
returnFalse
defis_watching_only(self):
returnFalse
returnself.force_watching_only
defget_client(self,noPin=False):
ifnotBTCHIP:
@ -258,9 +270,6 @@ class BTChipWallet(NewWallet):
defget_master_public_key(self):
try:
ifnotself.mpk:
self.get_client()# prompt for the PIN if necessary
ifnotself.check_proper_device():
self.give_error('Wrong device or password')
self.mpk=self.get_public_key("44'/0'")
returnself.mpk
exceptException,e:
@ -278,6 +287,7 @@ class BTChipWallet(NewWallet):
defsign_message(self,address,message,password):
use2FA=False
self.signing=True
self.get_client()# prompt for the PIN before displaying the dialog if necessary
ifnotself.check_proper_device():
self.give_error('Wrong device or password')
@ -298,11 +308,15 @@ class BTChipWallet(NewWallet):
self.get_client(True)
signature=self.get_client().signMessageSign(pin)
exceptException,e:
self.give_error(e,True)
ife.sw==0x6a80:
self.give_error("Unfortunately, this message cannot be signed by BTChip. Only alphanumerical messages shorter than 140 characters are supported. Please remove any extra characters (tab, carriage return) and retry.")