Commit graph

3227 commits

Author SHA1 Message Date
SomberNight
7257172e1c
NetworkRetryManager: add random noise to time 2020-04-15 17:24:10 +02:00
SomberNight
76f0ad3271
util: add NetworkRetryManager, a baseclass for LNWorker and Network 2020-04-15 17:24:07 +02:00
SomberNight
90cb032721
lnworker: implement exponential backoff for retries 2020-04-15 17:24:04 +02:00
SomberNight
86b29603cb
network: (trivial) rename field to indicate private 2020-04-15 17:24:00 +02:00
SomberNight
ac749f3a19
network: introduce NUM_STICKY_SERVERS 2020-04-15 17:23:57 +02:00
SomberNight
34e3e48ba5
network: rm server_queue
it's no longer needed; now it was just an extra level of indirection
2020-04-15 17:23:54 +02:00
SomberNight
8baa79be88
network: implement exponential backoff for retries 2020-04-15 17:23:50 +02:00
SomberNight
cf1f2ba4dc
network: replace "server" strings with ServerAddr objects 2020-04-15 17:23:47 +02:00
ThomasV
ef2ff11926 fix tests (follow-up prev commit) 2020-04-14 18:35:50 +02:00
ThomasV
9224404108 Move callback manager out of Network class 2020-04-14 18:29:51 +02:00
ThomasV
73325831b7 run lnworker.main_loop directly on the event loop 2020-04-14 18:28:23 +02:00
Luke Childs
1d667fe932
Hard fail on bad server-string (#6086)
* If server-string can't be parsed, fall back to localhost.

Co-Authored-By: Luke Childs <lukechilds123@gmail.com>

Co-authored-by: ghost43 <somber.night@protonmail.com>
2020-04-14 12:15:28 +00: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
54e1520ee4
ln: check if chain tip is stale when receiving HTLC
if so, don't release preimage / don't forward HTLC
2020-04-13 17:04:27 +02:00
SomberNight
12283d625b
(trivial) rename lnchannel.channel_states to ChannelState 2020-04-13 16:02:05 +02:00
SomberNight
8e8ab775eb
lnchannel: make AbstractChannel inherit ABC
and add some type annotations, clean up method signatures
2020-04-13 15:57:53 +02:00
ThomasV
821431a239 lnpeer: move ping_if_required away from message_loop
If our connection dies because we went to sleep, message_loop
will stall and ping_if_required will never be called.
2020-04-13 11:34:58 +02:00
ThomasV
bddb0bfcdd Do not wait wallet sync to reestablish channel (revert e32807d29d). 2020-04-13 11:30:52 +02:00
SomberNight
fe86f91110
adapt to new aiohttp_socks: fix deprecation warnings
...\electrum\electrum\util.py:1096: DeprecationWarning: SocksConnector is deprecated. Use ProxyConnector instead.
  connector = SocksConnector(
...\Python38\site-packages\aiohttp_socks\proxy\socks5_proxy.py:37: DeprecationWarning: Parameter family is deprecated and will be ignored.
  super().__init__(
2020-04-13 05:00:26 +02:00
SomberNight
10c358dd38
bitbox02: rm plugin.get_client method: just use default impl 2020-04-12 15:34:19 +02:00
SomberNight
dda20583c2
bitbox02: rm BitBox02Client.label override
if placeholder anyway, just use base impl
(alternatively we should list it in electrum.plugin.PLACEHOLDER_HW_CLIENT_LABELS)
2020-04-12 15:34:19 +02:00
SomberNight
e830ef309f
hww: factor out part of hid scan code to HW_PluginBase
so that bitbox02 can override it
2020-04-12 15:34:19 +02:00
SomberNight
66c264f613
bitcoin.py: change API of address_to_hash 2020-04-12 15:34:19 +02:00
SomberNight
cc4aa1812d
rm some unused imports 2020-04-12 15:34:19 +02:00
SomberNight
ffe3cef21a
bitbox02: don't run show_xpub on GUI thread 2020-04-12 15:34:19 +02:00
SomberNight
0268b63fcb
bitbox02: rm some dead code 2020-04-12 15:34:19 +02:00
SomberNight
15102855c1
bitbox02: fix pairing_dialog 2020-04-12 15:34:19 +02:00
SomberNight
c0c3627bd2
bitbox02: adapt to updated master 2020-04-12 15:34:19 +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
ThomasV
27949cb0e5 add list_peer command. (fix #6057) 2020-04-12 12:48:44 +02:00
ThomasV
99f933401a add more logging shortcuts 2020-04-12 12:30:59 +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
e2544b893a rm dead code: wallet.wait_until_synchronized 2020-04-11 15:26:29 +02:00
ThomasV
312ef15cd6 fix #6056 2020-04-11 12:02:38 +02:00
ThomasV
7a11c05916 fix #6075 2020-04-11 10:56:43 +02:00
ThomasV
e50f6d29ed export channel backup from kivy gui 2020-04-10 20:04:24 +02:00
ThomasV
74517c88ad do not use short_channel_id as state, use channel state for that.
display it as soon as the funding tx is mined.
2020-04-10 15:10:50 +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
b6bac0182f
wizard hww: use exception handling to choose hw device again
- no need to pass args, caller knows what it wanted
- avoids deepening the call stack on every rescan
  (nicer tracebacks, no stack overflow)
2020-04-09 19:45:45 +02:00
SomberNight
71eed1d4cb
wizard: (trivial) add show_error to base class, document API 2020-04-09 19:45:42 +02:00
SomberNight
08a7925235
wizard.create_storage: state API and abide by it
none of the callers was handling the return None case properly...
2020-04-09 19:45:38 +02:00
SomberNight
a3e1b2e00c
wizard: hww creation flow: don't just swallow exception
if we just return here, the calling code will try to create the storage and fail
2020-04-09 19:45:35 +02:00
SomberNight
4b1d835304
wizard hww: scan devices fewer times and move away from GUI thread 2020-04-09 19:45:31 +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
ThomasV
5efaaa523a lnworker: check chain_hash when decoding channel update. 2020-04-09 15:16:07 +02:00
SomberNight
7c830cb221
wizard hww: move devmgr.scan_devices() away from GUI thread 2020-04-08 18:54:11 +02:00
SomberNight
7a4acb05f2
hww: fix threading issue in DeviceMgr: enumerate_func needs self.lock
E | gui.qt.main_window.[test_ms_p2wsh_2of3_cc3132_trezort_cc3133] | on_error
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\util.py", line 794, in run
    result = task.task()
  File "...\electrum\electrum\plugins\hw_wallet\qt.py", line 232, in trigger_pairings
    devices = devmgr.scan_devices()
  File "...\electrum\electrum\plugin.py", line 376, in func_wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\plugin.py", line 656, in scan_devices
    for f in self.enumerate_func:
RuntimeError: Set changed size during iteration
2020-04-08 18:46:28 +02:00
SomberNight
bf067f7558
HardwareClientBase: provide default implementation for label
and add warning about placeholders
2020-04-08 18:28:21 +02:00