Commit graph

202 commits

Author SHA1 Message Date
SomberNight
e68b6447cc
hww: catch exceptions when user clicks on hww qt status bar icon
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 167, in perform_hw1_preflight
    firmwareInfo = self.dongleObject.getFirmwareVersion()
  File "...\Python38\site-packages\btchip\btchip.py", line 561, in getFirmwareVersion
    response = self.dongle.exchange(bytearray(apdu))
  File "...\Python38\site-packages\btchip\btchipComm.py", line 127, in exchange
    raise BTChipException("Invalid status %04x" % sw, sw)
btchip.btchipException.BTChipException: Exception : Invalid status 6faa

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 120, in onPress
    self.func()
  File "...\electrum\electrum\plugins\hw_wallet\qt.py", line 260, in show_settings_dialog
    device_id = self.choose_device(window, keystore)
  File "...\electrum\electrum\plugins\hw_wallet\qt.py", line 253, in choose_device
    info = self.device_manager().select_device(self, keystore.handler, keystore)
  File "...\electrum\electrum\plugin.py", line 554, in select_device
    infos = self.unpaired_device_infos(handler, plugin, devices)
  File "...\electrum\electrum\plugin.py", line 545, in unpaired_device_infos
    soft_device_id=client.get_soft_device_id()))
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 88, in get_soft_device_id
    self._soft_device_id = self.request_root_fingerprint_from_device()
  File "...\electrum\electrum\plugins\hw_wallet\plugin.py", line 197, in request_root_fingerprint_from_device
    child_of_root_xpub = self.get_xpub("m/0'", xtype='standard')
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 55, in catch_exception
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 103, in get_xpub
    self.checkDevice()
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 210, in checkDevice
    self.perform_hw1_preflight()
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 198, in perform_hw1_preflight
    raise UserFacingException("Dongle is temporarily locked - please unplug it and replug it again")
electrum.util.UserFacingException: Dongle is temporarily locked - please unplug it and replug it again
2020-04-01 21:08:50 +02:00
SomberNight
2d3c2eeea9
keystore: add workaround for StoredDict issue #6066
note: not a proper fix... but works for now
2020-04-01 13:33:38 +02:00
SomberNight
18d245ad5c
hw wallets: during wallet creation, make sure to save correct label
When initialising a Trezor as part of the wallet creation,
device_info.label is still the old (None) label in on_hw_derivation.
This is because device_info was created during the initial scan.

related: #6063
2020-03-31 15:56:54 +02:00
SomberNight
7297e94970
hw wallets: handle cancellation for "query_choice" in wizard
E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\plugins\hw_wallet\qt.py", line 193, in win_query_choice
    self.choice = self.win.query_choice(msg, labels)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 545, in query_choice
    self.exec_layout(vbox, '')
  File "...\electrum\electrum\gui\qt\installwizard.py", line 392, in exec_layout
    raise UserCancelled
electrum.util.UserCancelled
2020-03-31 15:11:10 +02:00
SomberNight
6760c3f252
hw wallets: introduce HardwareHandlerBase
previously, client.handler was sometimes
- an InstallWizard
- a QtHandlerBase where win was an ElectrumWindow
- a QtHandlerBase where win was an InstallWizard
- a CmdLineHandler

That's just too much dynamic untyped undocumented polymorphism...
Now it will never be an InstallWizard (replaced with QtHandlerBase where win is an InstallWizard),
and now in all cases client.handler is an instance of HardwareHandlerBase, yay.

related: #6063
2020-03-31 14:40:25 +02:00
SomberNight
f8ba660583
clean-up hw-wallet "get_password_for_storage_encryption"-related code 2020-02-28 19:47:56 +01:00
SomberNight
22861b70ee
Qt tx dialog: make "export with xpubs" option always available
not just if one of the keystores is a coldcard

related: https://github.com/spesmilo/electrum/issues/5969#issuecomment-591441399
2020-02-27 03:14:13 +01:00
SomberNight
36629f0957
cosigner_pool plugin: don't show button in tx dialog before finalizing
(previously button would be shown for a watch-only multisig wallet)
2020-02-23 20:38:57 +01:00
SomberNight
7f8d667e85
Revert "qt/hww: temporarily bundle our own version of safetlib.qt.pinmatrix"
This reverts commit 7f3de8241c.

(can finally undo this due to bb94712a14)
2020-02-21 18:32:58 +01:00
ThomasV
9a462ac9b5 trustedcoin: fix wallet constructor 2020-02-20 20:59:18 +01:00
SomberNight
9c5e49f432
ecc.ECPubkey: also accept bytearray in __init__
regression since #5947

Traceback (most recent call last):
  File "...\electrum\electrum\base_wizard.py", line 339, in on_device
    self.plugin.setup_device(device_info, self, purpose)
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 598, in setup_device
    client.get_xpub("m/44'/0'", 'standard') # TODO replace by direct derivation once Nano S > 1.1
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 55, in catch_exception
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 124, in get_xpub
    eckey=ecc.ECPubkey(publicKey),
  File "...\electrum\electrum\ecc.py", line 145, in __init__
    self._x, self._y = _x_and_y_from_pubkey_bytes(b)
  File "...\electrum\electrum\ecc.py", line 119, in _x_and_y_from_pubkey_bytes
    ret = _libsecp256k1.secp256k1_ec_pubkey_parse(
ctypes.ArgumentError: argument 3: <class 'TypeError'>: wrong type
2020-02-19 00:40:33 +01:00
SomberNight
07f5d6b745
keystore: 'get_tx_derivations' no longer public 2020-02-12 18:14:00 +01:00
ThomasV
e1ce3aace7 Separate db from storage
- storage is content-agnostic
 - db and storage are passed to wallet contructor
2020-02-10 17:45:23 +01:00
SomberNight
34392e82b9
cosigner pool: easy fix (works but with worse than previous behaviour)
got broken as part of PSBT changes in #5721
2020-02-07 20:09:40 +01:00
ThomasV
dbceed2647 Restructure wallet storage:
- Perform json deserializations in wallet_db
 - use StoredDict class that keeps tracks of its modifications
2020-02-04 13:35:58 +01:00
SomberNight
d2f132738a
wallet: only select mature coins by default
this is a regression from #5721

Removed the `TxInput.is_coinbase` method as I think it is a confusing API,
instead we now have `TxInput.is_coinbase_input` and `TxInput.is_coinbase_output`.

related #5872
2020-01-02 00:43:49 +01:00
SomberNight
a8e81c0bd2
keepkey: use libusb to enumerate devices instead of hid 2019-12-20 01:30:10 +01:00
SomberNight
18209fc782
trezor: when restoring, hide Shamir options by default
They become visible once user clicks "Show expert settings"
2019-12-19 16:50:35 +01:00
matejcik
006c6c1a58 trezor: use BIP39 backup by default even if Shamir is available 2019-12-18 12:36:13 +01:00
matejcik
da41e4c289 trezor: bump library requirement 2019-12-18 12:36:13 +01:00
matejcik
3fc70bd97a trezor: implement support for Shamir recovery 2019-12-18 12:36:13 +01:00
matejcik
f4e2781786 trezor: link button messages to enum names 2019-12-18 12:36:13 +01:00
SomberNight
33facd151d
ledger.sign_transaction: always do certain output checks 2019-12-17 21:33:07 +01:00
SomberNight
ee63e84bcf
ledger: faster sign_transaction startup
Only call Ledger_KeyStore.get_client_electrum() once,
as it runs DeviceMgr.scan_devices(), which is slow.
2019-12-17 21:19:57 +01:00
SomberNight
6b8c447eb9
ledger: support sending to OP_RETURN outputs
closes #5849

based on:
ca9b432ff0
7bb27eff84
2019-12-17 21:10:14 +01:00
SomberNight
fcd9752f19
keystore: change derive_pubkey API to return bytes 2019-12-10 20:41:47 +01:00
SomberNight
0ab88b821c
keystore: use abstract base classes, introduce MPKMixin 2019-12-10 00:31:01 +01:00
SomberNight
d2a8028cde
qt receive tab: show plain bitcoin address 2019-12-07 06:06:36 +01:00
SomberNight
428b63822b
trezor: rm obsolete gui text 2019-12-04 20:54:53 +01:00
SomberNight
d3fd87ebd0
hardware wallets: wizard no longer requests xpub at path "m"
This was done to calculate the bip32 root fingerprint but it broke
the digitalbitbox. The keystore already had a different way to get
the root fingerprint for existing wallets, specifically handling this
case; the code in base_wizard used when creating new wallets was
duplicating that code originally and was then forgotten to be updated.
Now these codepaths are unified.

closes #5816
2019-12-02 19:31:17 +01:00
Riccardo Casatta
8c30ae78be
remove GreenAddress instant plugin
GreenAddress instant feature has been removed from the service, thus
there is no reason anymore to keep the plugin
2019-11-27 17:51:25 +01:00
SomberNight
88307357ec
add some type hints
mostly related to hw wallets
2019-11-22 22:59:33 +01:00
SomberNight
c2b0039935
bitcoin.py: remove some remnants of TYPE_ADDRESS, TYPE_SCRIPT 2019-11-21 18:51:38 +01:00
SomberNight
b8e4ce9ba1
hardware wallets: handle when label is None
follow-up 56c3de0e1e
2019-11-18 18:13:26 +01:00
SomberNight
56c3de0e1e
hardware wallets: better handle label collision when selecting device
related: #5759
2019-11-17 01:15:44 +01:00
SomberNight
0c0a6b2145
TxDialog: fix hooks. only show psbt widgets when applicable.
users of 'transaction_dialog' were assuming that dialog.tx is already set
2019-11-12 23:05:01 +01:00
SomberNight
f8c84fbb1e
hardware wallets: create base class for HW Clients. add some type hints 2019-11-11 17:04:12 +01:00
SomberNight
cc4f6804b0
psbt: follow-ups: fix trezor 2019-11-05 23:32:00 +01:00
SomberNight
dd14a3fde5
psbt: follow-ups: fix digital bitbox 2019-11-05 22:06:46 +01:00
SomberNight
9e86352022
psbt: follow-ups: fix ledger 2019-11-05 21:34:54 +01:00
SomberNight
c8c1ea9c86
qt tx dialog: add export options for coinjoins and for coldcard 2019-11-04 22:25:06 +01:00
SomberNight
d872be7f6b
psbt: don't put xpubs and full paths into tx by def; only while signing 2019-11-04 22:25:02 +01:00
SomberNight
e6c841d05f
psbt: put fake xpubs into globals. keystores handle xfp/der_prefix missing 2019-11-04 22:24:59 +01:00
SomberNight
bafe8a2fff
integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
Peter D. Gray
ec2bdbd02d
plugins/coldcard/qt.py: bugfix for API change on main_window.show_transaction 2019-11-04 09:21:41 -05:00
SomberNight
04edad9984
config: no longer singleton. it is passed to Wallet.__init__
The few other cases that used SimpleConfig.get_instance() now
either get passed a config instance, or they try to get a reference
to something else that has a reference to a config.
(see lnsweep, qt/qrcodewidget, qt/qrtextedit)
2019-09-22 20:46:01 +02:00
SomberNight
26ff7a6265
coldcard tx dialog: "export PSBT" button should not raise on foreign ks
tested trezor/coldcard mixed multisig and it worked; no reason to enforce
that the first keystore must be coldcard (order should not matter)
2019-09-18 18:29:33 +02:00
SomberNight
1236b07abf
coldcard: show multisig address: more intuitive error msg
cause of error is probably almost always what msg says
2019-09-18 18:29:32 +02:00
SomberNight
9c83bc1008
coldcard qt: change receive_menu to be similar to other hw plugins
you should not interact with the hw device in the GUI thread if possible...
right-click was lagging
2019-09-18 18:29:32 +02:00
SomberNight
4e6cc93746
coldcard: do link_wallet in load_wallet hook instead
make_unsigned_transaction might not run in some code paths
(e.g. when user uses "Load transaction" UI function)
2019-09-18 18:29:31 +02:00