Commit graph

52 commits

Author SHA1 Message Date
zebra-lucky
949b247b19
fix raise UserCacnelled calls (#6304) 2020-07-01 15:37:31 +00:00
SomberNight
446f21c206
qt first-time network setup: fix edge case
previously, consider following flow:
- user selects "Select server manually"
- "next"
- network dialog is shown, user leaves everything at default
- "next"
- we would not save the "auto_connect" key, and hence the first-time
  network setup will be shown during the next app start again
2020-05-21 19:27:46 +02:00
SomberNight
08118ca167
qt wizard: tweak GoBack behaviour to recalc inputs to previous dialog
follow-up f13f46c555

When on dialog n user presses "Back",
- previously, we went back to when dialog n-1 appeared
- now, go back to just after dialog n-2 finishes
This way, any calculations between when dialog n-2 finishes and
dialog n-1 appears will rerun, potentially populating dialog n-1 differently.

Namely if the user presses back on the confirm_seed_dialog, we want to
go back to the show_seed_dialog but with a freshly generated seed.
2020-04-11 15:50:12 +02:00
SomberNight
01dac92e19
wizard: fix crash when decrypting wallet hw device
E | __main__ | daemon.run_gui errored
Traceback (most recent call last):
  File ".../electrum/run_electrum", line 379, in <module>
    d.run_gui(config, plugins)
  File "...\electrum\electrum\daemon.py", line 522, in run_gui
    self.gui_object.main()
  File "...\electrum\electrum\gui\qt\__init__.py", line 362, in main
    if not self.start_new_window(path, self.config.get('url'), app_is_starting=True):
  File "...\electrum\electrum\gui\qt\__init__.py", line 246, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\gui\qt\__init__.py", line 270, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "...\electrum\electrum\gui\qt\__init__.py", line 308, in _start_wizard_to_select_or_create_wallet
    path, storage = wizard.select_storage(path, self.daemon.get_wallet)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 334, in select_storage
    pw_e.clear()
  File "...\electrum\electrum\gui\qt\util.py", line 759, in clear
    self.setText(len(self.text()) * " ")
RuntimeError: wrapped C/C++ object of type PasswordLineEdit has been deleted
2020-04-09 17:55:42 +02:00
SomberNight
5259fcb6fd
qt PasswordLineEdit: try to clear password from memory
If an attacker has access to the process' memory, it's probably already game over,
still we can make their life a bit harder.

I really tried but failed to encapsulate this logic inside PasswordLineEdit.
The destroyed signal arrives too late.
deleteLater is not called.
__del__ gets called too late.
2020-04-07 18:58:42 +02:00
SomberNight
c798e5d9a1
qt: introduce PasswordLineEdit(QLineEdit) 2020-04-07 18:58:37 +02:00
SomberNight
f13f46c555
qt wizard: make "GoBack" unroll the call stack to avoid stack overflow
fixes #6069
2020-04-03 18:58:51 +02:00
SomberNight
1cdff09ead
follow-up 371f55a0f9 2020-04-02 14:39:01 +02:00
SomberNight
371f55a0f9
hww: fix some threading issues in wizard
fixes #3377
related: #6064  (passphrase dialog not rendered correctly)
2020-04-01 21:09:17 +02:00
SomberNight
18c98483ac
wizard: (trivial) add some type hints 2020-04-01 21:09:10 +02:00
SomberNight
e6d43b60fa
qt hww show_settings_dialog: don't scan devices in GUI thread
Just makes sense in general.
Also, previously, the GUI would freeze if right after startup the user
clicked the hww status bar icon (especially with multiple hww connected).
2020-04-01 21:09:06 +02:00
SomberNight
e53ce5dee0
(trivial) follow-up 570f7b7790 2020-03-31 18:57:03 +02:00
SomberNight
570f7b7790
qt wizard decrypt wallet with hww: just pass through cancellation
E | gui.qt.installwizard.InstallWizard |
Traceback (most recent call last):
  File "...\electrum\electrum\base_wizard.py", line 541, in create_wallet
    password = k.get_password_for_storage_encryption()
  File "...\electrum\electrum\keystore.py", line 768, in get_password_for_storage_encryption
    client = self.plugin.get_client(self)
  File "...\electrum\electrum\plugins\trezor\trezor.py", line 180, in get_client
    client = devmgr.client_for_keystore(self, handler, keystore, force_pair)
  File "...\electrum\electrum\plugin.py", line 465, in client_for_keystore
    info = self.select_device(plugin, handler, keystore, devices)
  File "...\electrum\electrum\plugin.py", line 585, in select_device
    raise UserCancelled()
electrum.util.UserCancelled

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\installwizard.py", line 300, in select_storage
    self.run('choose_hw_device', HWD_SETUP_DECRYPT_WALLET, storage=temp_storage)
  File "...\electrum\electrum\base_wizard.py", line 109, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 332, in choose_hw_device
    self.choice_dialog(title=title, message=msg, choices=choices,
  File "...\electrum\electrum\gui\qt\installwizard.py", line 99, in func_wrapper
    out = func(*args, **kwargs)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 536, in choice_dialog
    self.exec_layout(vbox, title)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 392, in exec_layout
    raise UserCancelled
electrum.util.UserCancelled
2020-03-31 15:28:57 +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
8e9b401c88
wizard: add a warning to multisig wallet creation to backup xpubs 2020-03-31 07:44:23 +02:00
SomberNight
0845300150
qt InstallWizard: turn some instance variables to locals 2020-02-18 21:12:46 +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
1059191ebc
qt installwizard: fix empty filename crash
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\installwizard.py", line 256, in on_filename
    widget_create_new.setVisible(temp_storage and temp_storage.file_exists())
TypeError: setVisible(self, bool): argument 1 has unexpected type 'NoneType'
2020-01-07 16:53:37 +01:00
SomberNight
c9ede07462 wizard: (qt) add dedicated button to create new wallet 2019-12-12 17:54:46 +01:00
SomberNight
5e04f084b7
qt wizard: follow-up prev; simplify 2019-09-14 16:25:35 +02:00
SomberNight
f44f7d60ab
qt wizard: still show selector window if storage.__init__ raises WFE
(WalletFileException; e.g. if storage version is from the future)
2019-09-14 16:22:06 +02:00
SomberNight
a05dab2c4d
storage: read/write sanity checks
related: #4110
supersedes: #4528
2019-09-10 21:17:15 +02:00
SomberNight
4dda162336
qt wizard: turn 'temp_storage' into local variable 2019-09-10 20:19:41 +02:00
SomberNight
bcdb72ae93
qt: add some type hints 2019-09-09 22:19:36 +02:00
SomberNight
bffc2a1d4b
wizard: try harder to have temporarily stored pw erased from memory 2019-08-14 17:27:38 +02:00
SomberNight
f60f690ca9
change many str(e) to repr(e) as some exceptions were cryptic
it's often valuable to see the type of the exception
(especially as for some exceptions str(e) == '')
2019-07-17 20:12:52 +02:00
SomberNight
37809bed74
qt high dpi: fix some text fields
There are probably other DPI related issues though.

closes #5471
closes #4597
closes #1927
2019-06-29 05:27:28 +02:00
SomberNight
0ef853c046
rm dead code 2019-06-03 20:35:37 +02:00
SomberNight
7aaac2ee30
qt wizard: change wizard_dialog semantics to raise exceptions
Specifically GoBack and UserCancelled will not be suppressed anymore.
Previously, if 'run_next' raised GoBack, that would propagate out fully,
while if 'func' itself raised it would be suppressed. This was confusing.

somewhat related: #5334
2019-05-14 15:31:33 +02:00
SomberNight
f6dfcccf8c
qt: factor out util.MessageBoxMixin.msg_box into function and use it
so these dialogs also get our custom default settings applied,
e.g. their text is selectable by mouse
2019-05-13 23:59:29 +02:00
SomberNight
3385a94753
logging: basics 2019-05-02 15:19:03 +02:00
SomberNight
12b98fa251
wizard: fix regression: unencrypted wallets were not getting upgraded
fixes #5177
2019-03-04 17:23:43 +01:00
SomberNight
93fa9a9d69
wizard: partial revert of 2da6692f73 2019-03-04 02:46:50 +01:00
SomberNight
d55a045405
qt wizard: minor clean-up 2019-03-04 02:20:34 +01:00
SomberNight
2da6692f73
wizard: some fixes
related: #5174
2019-03-04 02:08:23 +01:00
SomberNight
7458461f13
wizard: fix decryption of hw wallet files
see #5174
2019-03-03 17:33:13 +01:00
SomberNight
b6d5304e51
qt: close wizard after splitting an old multi-account wallet
instead of trying to open the old pre-split file
2019-03-01 20:50:17 +01:00
SomberNight
ef8d7e3227
qt wizard: don't consider old version storage to be incomplete 2019-03-01 19:44:20 +01:00
ThomasV
3631c27ed7 fix: load trustedcoin plugin for two-step wallet creation 2019-02-28 13:11:00 +01:00
SomberNight
4b36114d0d small fixups 2019-02-28 09:02:58 +01:00
ThomasV
d5790ea109 wizard: do not use on storage object during wallet creation 2019-02-28 09:02:58 +01:00
SomberNight
2d6a68545b
qt installwizard: fix small regression
related: #5139 and 8f4967f7d0
2019-02-19 15:40:29 +01:00
SomberNight
026448837f
no more "import *"
fixes #5101
fixes #5105
2019-02-11 20:21:24 +01:00
ThomasV
8f4967f7d0 qt wizard: select_storage 2019-02-08 09:10:07 +01:00
SomberNight
9013f6d59e
wizard: make 'stack' private 2019-02-04 20:27:00 +01:00
SomberNight
16bac5fd73
rm qt icons file
so we don't need pyrcc5, which is not deterministic,
and so we don't need the submodule for the icons

based on electrumsv/electrumsv@bf8802c2ea
2019-02-01 20:15:28 +01:00
SomberNight
d0e6b8c89d
hw: fix passphrase dialog with confirmation
closes #4876
2018-11-28 20:54:57 +01:00
SomberNight
47b6d3c52c
wizard: make native segwit (bech32) the default for bip39/hw 2018-11-08 13:01:40 +01:00
SomberNight
1af225015a
fix some type annotations involving tuples 2018-10-13 05:16:36 +02:00
SomberNight
0137626a63
wallet restore: remove dead code. add log lines. 2018-08-28 18:20:35 +02:00