Page MenuHomePhabricator

[electrum] print a less alarming error when the wrong app is open on a Ledger device
ClosedPublic

Authored by PiRK on Jun 20 2024, 16:13.

Details

Summary

Previously if the ETH app was open on the device when opening the wallet, client.get_xpub -> client.checkDevice() in force_pair_xpub would raise a RuntimeError, which would be caught and cause the following alarming DeviceUnpairableError to be printed in a dialog. Raise a new custom DeviceNotInBitcoinCashModeError instead with a more helpful message, as we now what the cause of the issue is.

And when the BTC app was open, an unhelpful "Exception: Invalid status 6e00" dialog would show up. Handle this as well with the same error.

If the status is 0c6D00, it could also be caused by a compatibility issue with a newer firmware or BCH app version. In that case, print the full error message.

Test Plan

Try the various scenarios described above, check the usefulness of the error message

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jun 20 2024, 16:13
Fabien added inline comments.
electrum/electrumabc_plugins/ledger/ledger.py
310 ↗(On Diff #48334)

0x6D00 can be raised for unknown commands, so upon ledger app update that is not under our control. In this case the message would be wrong as it's correctly using the BCH app

PiRK edited the summary of this revision. (Show Details)

handle the 0x6d00 status separately, show a full exception traceback in the dialog.

PiRK planned changes to this revision.Jun 21 2024, 07:32

remove debugging related line

This revision is now accepted and ready to land.Jun 21 2024, 08:01