Multibit-Legacy / multibit-hd

Deprecated Bitcoin Wallet
https://multibit.org/blog/2017/07/26/multibit-shutdown.html
Other
170 stars 112 forks source link

Sign message after change PIN crashes app #729

Closed jim618 closed 8 years ago

jim618 commented 8 years ago

If you change the PIN value and then do a sign message, the PIN matrix is shown (on a KeepKey) but it crashes MBHD with:

[2015-09-24 13:23:35,480] DEBUG [safe-fixed-hardware-wallet-events-0] o.m.h.u.c.MainController - Received hardware event: 'SHOW_PIN_ENTRY' 
[2015-09-24 13:23:35,482] DEBUG [safe-fixed-hardware-wallet-events-0] o.m.h.h.c.e.HardwareWalletEvents - Completed 'hardware wallet' event: SHOW_PIN_ENTRY 
[2015-09-24 13:23:35,490] ERROR [AWT-EventQueue-1] o.m.h.c.e.ExceptionHandler - Uncaught exception. Proceeding to show Error Reporting dialog... ! java.lang.IllegalStateException: Unknown state: SIGN_MESSAGE_TREZOR_CONFIRM_SIGN
! at org.multibit.hd.ui.views.wizards.sign_message.SignMessageWizardModel.showPINEntry(SignMessageWizardModel.java:234) ~[classes/:na]
! at org.multibit.hd.ui.views.wizards.AbstractHardwareWalletWizard$5.run(AbstractHardwareWalletWizard.java:227) ~[classes/:na]
jim618 commented 8 years ago

If you try this with a Trezor (change PIN, sign) when you do the sign you get a 'there is a new device, do you want to use it?' alert and then a PIN and encrypt challenge. You can then do a sign.

It is a bit round-the-houses but the app doesn't crash and once you've entered the PIN you can sign.

gary-rowe commented 8 years ago

Yes, this all part of the more specialised event handling required for additional wallet modes.

gary-rowe commented 8 years ago

It turns out that there is a subtle difference in the response from a "resetToAttached" between a Trezor and KeepKey. The Trezor reattaches, whereas the KeepKey doesn't (at least in firmware 1.0.0). Using a "resetToConnected" which is arguably more appropriate in this use case fixes the issue so I'm not going to pursue it.

Also I uncovered a few places in the wizard report screens where a hardware failed was unbranded. These are now fixed.

Ready for review and close.

jim618 commented 8 years ago

KeepKey: This all works smoothly now. After a change PIN, when you sign a message your are asked if you want to sign a message on the KeepKey, then asked for your PIN, then returned to the Sign Message screen. Smooth.

Trezor: Workflow is the same as with KeepKey.

Closing