ledger: don't throw exception if user cancels signing
Used to show "Exception : Invalid status 6985", which is not really user-friendly. This now mimics the behaviour with Trezor where we silently ignore cancellation (not showing any popup).
# prompt for the PIN before displaying the dialog if necessary
@ -259,16 +269,17 @@ class Ledger_KeyStore(Hardware_KeyStore):
exceptBTChipExceptionase:
ife.sw==0x6a80:
self.give_error("Unfortunately, this message cannot be signed by the Ledger wallet. Only alphanumerical messages shorter than 140 characters are supported. Please remove any extra characters (tab, carriage return) and retry.")
elife.sw==0x6985:# cancelled by user
returnb''
else:
self.give_error(e,True)
exceptUserWarning:
self.handler.show_error(_('Cancelled by user'))
return''
returnb''
exceptExceptionase:
self.give_error(e,True)
finally:
self.handler.finished()
self.signing=False
# Parse the ASN.1 signature
rLength=signature[3]
r=signature[4:4+rLength]
@ -281,12 +292,11 @@ class Ledger_KeyStore(Hardware_KeyStore):
# And convert it
returnbytes([27+4+(signature[0]&0x01)])+r+s
@set_and_unset_signing
defsign_transaction(self,tx,password):
iftx.is_complete():
return
client=self.get_client()
self.signing=True
inputs=[]
inputsPaths=[]
pubKeys=[]
@ -446,6 +456,12 @@ class Ledger_KeyStore(Hardware_KeyStore):
exceptUserWarning:
self.handler.show_error(_('Cancelled by user'))
return
exceptBTChipExceptionase:
ife.sw==0x6985:# cancelled by user
return
else:
traceback.print_exc(file=sys.stderr)
self.give_error(e,True)
exceptBaseExceptionase:
traceback.print_exc(file=sys.stdout)
self.give_error(e,True)
@ -456,10 +472,9 @@ class Ledger_KeyStore(Hardware_KeyStore):