Commit graph

721 commits

Author SHA1 Message Date
SomberNight
5bf3115a4a
qt send tab: (fix) allow user to set lower fees if "not enough funds"
Previously if the user tried to pay an invoice, we tried to construct
a tx with the desired feerate. If this raise NotEnoughFunds, we would just
show the error and not let the user change the feerate.

related: https://github.com/spesmilo/electrum/issues/6136#issuecomment-622254754 (method 2)
2020-05-01 07:51:29 +02:00
SomberNight
b9bb78a1db
qt ConfirmTxDialog: fix exc for "max" invoice when "not enough funds"
"not enough funds" is possible even for "max" invoice due to fees

fixes #6136
2020-05-01 07:34:11 +02:00
SomberNight
0f6cbfba8e
qt update checker: do not keep main window ref so it can gc-ed
related: #4905
2020-05-01 06:39:55 +02:00
SomberNight
2105c6c4e6
qt exception window: turn Exception_Hook into singleton
related #4905
related Electron-Cash/Electron-Cash@6a3d76b0ab

conceptually did not really make sense that the Exception_Hook kept a reference
to an ~arbitrary main window (preventing gc)
2020-05-01 06:33:38 +02:00
ThomasV
ab5338b46b fix #6111, and show channels tab even if lightning is disabled (follow-up 527e0b9b89) 2020-04-29 11:41:57 +02:00
SomberNight
527e0b9b89
qt main window: only show "Channels" tab if wallet has lightning 2020-04-26 05:51:02 +02:00
SomberNight
100a216165
qt wallet>info: add text if lightning is not available for wallet 2020-04-26 05:49:34 +02:00
SomberNight
b59c3294b2
fix #6115: qt wallet>information was broken for imported wallets 2020-04-26 05:29:32 +02:00
SomberNight
58dee38ed2
qt network dialog: merge "Overview" and "Servers" tabs 2020-04-25 06:54:31 +02:00
SomberNight
bf223470ce
network: handle unparseable server-str
follow-up 9e57ae630b

fixes #6113
2020-04-25 06:53:25 +02:00
SomberNight
69de3b94db
config: "serverfingerprint" key requires "server" key
follow-up prev
2020-04-24 17:17:12 +02:00
Luke Childs
ca1046bce2
Add --serverfingerprint option (#6094)
* Add --fingerprint option

* Simplify conditional checks

* Improve warning wording

* Throw error instead of logging and returning

* --fingerprint => --serverfingerprint

* Only run fingerprint checks against main server

* Throw error if --serverfingerprint is set for a non SSL main server

* Fix linting errors

* Don't check certificate fingerprint in a seperate connection

* Disallow CA signed certs when a fingerprint is provided

* Show clear error and then exit for Qt GUI users

* Remove leading newlines from error dialog

* Always check is_main_server() when getting fingerprint

* Document how to generate SSL cert fingerprint
2020-04-24 14:11:40 +00:00
Evgeny Zinoviev
64733a39dc
set more restrictive file permissions for exported private keys (#6106) 2020-04-21 23:01:41 +00:00
SomberNight
8f4c384aad
qt crash reporter: html.escape traceback to avoid formatting issues
fixes #6099
2020-04-18 05:48:11 +02:00
SomberNight
9e57ae630b
network/gui: unify host/port input fields to single server str
This allows optionally specifying the protocol for the main server.

fixes #6095
fixes #5278
2020-04-16 21:19:48 +02:00
SomberNight
b2cfaddff2
network.NetworkParameters: merge host+port+protocol into "server" field 2020-04-16 21:19:45 +02:00
SomberNight
adc3784bc2
network: allow mixed protocols among interfaces
Previously all the interfaces used either "t" or "s".
Now the network only tries to use "s" for all interfaces, except for
the main interface, which the user can manually specify to use "t".
(so e.g. if you run with "--server localhost:50002:t", the main server will use "t",
but all the rest will use "s")
2020-04-16 21:19:42 +02:00
SomberNight
cf1f2ba4dc
network: replace "server" strings with ServerAddr objects 2020-04-15 17:23:47 +02:00
ThomasV
9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
SomberNight
40dc54e8b8
macOS: duplicate Qt "Preferences" menu item
There is a standardised location along with reserved hotkey for "Preferences"
in applications on macOS. Let's put *another* preferences menu item there.

The duplicate items ensure that
- an electrum user coming from a different OS,
- a macOS user used to the standardised preferences location,
will both find "Preferences" easily.
2020-04-13 19:53:52 +02:00
SomberNight
12283d625b
(trivial) rename lnchannel.channel_states to ChannelState 2020-04-13 16:02:05 +02:00
TheCharlatan
a4fe14bb82
BitBox02 Electrum plugin support
This commit adds support for the BitBox02 hardware wallet.
It supports both single and multisig for the electrum gui wallet.

To use the plugin a local installation of the BitBox02 python library is
required. It can be found on PiPy under the name 'bitbox02' and can be
installed from the bitbox02-firmware repository in the py/bitbox02
directory.

All communication to and from the BitBox02 is noise encrypted, the keys
required for this are stored in the wallet config file under the
bitbox02 key.

The BitBox02 registers a multisig configuration before allowing
transaction signing. This multisig configuration includes the threshold,
cosigner xpubs, keypath, a variable to indicate for mainnet and testnet,
and a name that the user can choose during configuration registration.
The user is asked to register the multisig configuration either during
address verification or during transaction signing.

The check the xpub of the BitBox02 for other hardware wallets, a button
is added in the wallet info dialog.

The wallet encryption key is fetched in a separate api call, requiring a
slightly tweaked override version of the wallet encryption password.
2020-04-12 15:34:37 +02:00
ThomasV
bfffc7cb1e Rename 'On-chain' button, add tooltips (see #6053) 2020-04-12 12:57:07 +02:00
SomberNight
9a88c13b3d
translations: add note that f-strings cannot be translated
and replace current usage
2020-04-11 16:33:45 +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
ThomasV
312ef15cd6 fix #6056 2020-04-11 12:02:38 +02:00
ThomasV
8f41aeb783 Replace wallet backup with channel backups
- channels can be backed up individually
 - backups are added to lnwatcher
 - AbstractChannel ancestor class
2020-04-10 14:45:23 +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
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
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
JeremyRand
001ee25604
UTXOList: Split stretch_column out of __init__
Makes it easier to subclass UTXOList without code duplication.
2020-03-29 05:53:31 +00:00
ThomasV
bb35e330fb do not show freeze/unfreeze channel options if channel is closed 2020-03-27 11:19:27 +01:00
SomberNight
3ed6afce64
lnchannel: implement freezing channels (for receiving)
A bit weird, I know... :)
It allows for rebalancing our own channels! :P
2020-03-26 09:05:15 +01:00
SomberNight
79d202485e
lnworker: rename can_send to num_sats_can_send 2020-03-26 09:05:12 +01:00
SomberNight
deb50e7ec3
lnchannel: implement "freezing" channels (for sending)
and expose it in Qt GUI
2020-03-26 03:32:44 +01:00
SomberNight
9c8d2be638
qt channels list: sort by short chan id by default 2020-03-26 02:54:50 +01:00
SomberNight
95979ba58d
qt channels list: make selection more in line with other tabs
(allow selecting none, and allow multi-select)
2020-03-26 02:54:21 +01:00
SomberNight
7488cc91cd
qt channels: expose long channel id (in ctx menu and details dlg)
Also add separators to context menu to more visible separate
close/delete actions from rest.
2020-03-26 01:20:41 +01:00
ThomasV
5bac2fea98 Qt: improve channel details window 2020-03-12 12:40:50 +01:00
ThomasV
6c2ef176cc kivy: show payment log details 2020-03-10 16:44:23 +01:00