1
0
Commit Graph

13205 Commits

Author SHA1 Message Date
SomberNight
13c45bd798 qt send tab: mention frozen balance if "not enough funds" in more cases
fixes #6912
2021-01-06 03:05:13 +01:00
SomberNight
4b5616ff14 qt BlockingWaitingDialog: try harder to get label drawn (refresh bug) 2021-01-06 02:29:59 +01:00
SomberNight
85f76523b6 qt tx dialog: use WaitingDialog for network requests in __init__ 2021-01-06 02:27:17 +01:00
SomberNight
422f7ad110 qt tx dialog: fix visual artifact when opening (widget parenting issue) 2021-01-06 02:24:51 +01:00
ThomasV
177766ac37 lnpeer: fix a comment 2021-01-04 12:39:24 +01:00
ThomasV
07b08738a8 kivy wizard: checkum bip39 seeds, because the virtual keyboard imposes the English wordlist 2021-01-02 16:38:05 +01:00
ThomasV
b2ab2a9f6a wizard: call on_restore_seed, on_restore_bip39 through self.run. fixes #6895 2021-01-02 14:24:11 +01:00
ThomasV
77e0d3745e fix #4326 2021-01-02 11:48:15 +01:00
ThomasV
7e36770a06 fix #6605 2020-12-31 13:00:24 +01:00
ThomasV
eb6eac9254 fix reserve_sat in local_config. see #6896 2020-12-31 08:44:26 +01:00
ThomasV
d70431c0e7 lnchannel.available_to_spend: return zero if frozen or not active. Without this, the channel details window displays can_send/can_receive values that are inconsistent with the main window 2020-12-30 11:51:02 +01:00
ThomasV
b29cdc02da Require gossip_queries in LNWallet (follow-up f83d2d9fee)
- workaround lnd bug https://github.com/lightningnetwork/lnd/issues/3651
 - also reduces bandwidth usage
2020-12-28 15:41:42 +01:00
ThomasV
c478f3bb91 channel backups: fix exception in raised after channel is force closed
Traceback (most recent call last):
  File "/opt/electrum/electrum/util.py", line 1056, in wrapper
    return await func(*args, **kwargs)
  File "/opt/electrum/electrum/lnwatcher.py", line 183, in on_network_update
    await callback()
  File "/opt/electrum/electrum/lnwatcher.py", line 200, in check_onchain_situation
    keep_watching = await self.do_breach_remedy(funding_outpoint, closing_tx, spenders)
  File "/opt/electrum/electrum/lnwatcher.py", line 377, in do_breach_remedy
    sweep_info_dict = chan.sweep_ctx(closing_tx)
  File "/opt/electrum/electrum/lnchannel.py", line 227, in sweep_ctx
    our_sweep_info = self.create_sweeptxs_for_our_ctx(ctx)
  File "/opt/electrum/electrum/lnchannel.py", line 216, in create_sweeptxs_for_our_ctx
    return create_sweeptxs_for_our_ctx(chan=self, ctx=ctx, sweep_address=self.sweep_address)
  File "/opt/electrum/electrum/lnchannel.py", line 321, in sweep_address
    assert self.lnworker.wallet.is_mine(addr)
AssertionError
2020-12-27 18:11:42 +01:00
ThomasV
39fc72dad6 add paste button to qt payto_e. fixes #6878 2020-12-27 12:01:43 +01:00
SomberNight
112ad72cee qt: follow-up passing-around-config
follow-up b28b3994c7

E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 670, in new_wallet
    self.gui_object.start_new_window(full_path, None)
  File "...\electrum\electrum\gui\qt\__init__.py", line 245, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\gui\qt\__init__.py", line 269, in start_new_window
    wallet = self._start_wizard_to_select_or_create_wallet(path)
  File "...\electrum\electrum\gui\qt\__init__.py", line 311, in _start_wizard_to_select_or_create_wallet
    wizard.run('new')
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 153, in new
    self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 193, in on_wallet_type
    self.run(action)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 201, in choose_multisig
    self.multisig_dialog(run_next=on_multisig)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 200, in on_multisig
    self.run('choose_keystore')
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 225, in choose_keystore
    self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 275, in choose_hw_device
    self._choose_hw_device(purpose=purpose, storage=storage)
  File "...\electrum\electrum\base_wizard.py", line 358, in _choose_hw_device
    self.choice_dialog(title=title, message=msg, choices=choices,
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 359, in <lambda>
    run_next=lambda *args: self.on_device(*args, purpose=purpose, storage=storage))
  File "...\electrum\electrum\base_wizard.py", line 394, in on_device
    self.derivation_and_script_type_dialog(f)
  File "...\electrum\electrum\base_wizard.py", line 441, in derivation_and_script_type_dialog
    self.derivation_and_script_type_gui_specific_dialog(
  File "...\electrum\electrum\gui\qt\installwizard.py", line 120, in func_wrapper
    run_next(*out)
  File "...\electrum\electrum\base_wizard.py", line 393, in f
    self.run('on_hw_derivation', name, device_info, derivation, script_type)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 490, in on_hw_derivation
    self.on_keystore(k)
  File "...\electrum\electrum\base_wizard.py", line 592, in on_keystore
    self.run('show_xpub_and_add_cosigners', xpub)
  File "...\electrum\electrum\base_wizard.py", line 115, in run
    f(*args, **kwargs)
  File "...\electrum\electrum\base_wizard.py", line 686, in show_xpub_and_add_cosigners
    self.show_xpub_dialog(xpub=xpub, run_next=lambda x: self.run('choose_keystore'))
  File "...\electrum\electrum\gui\qt\installwizard.py", line 106, in func_wrapper
    out = func(*args, **kwargs)
  File "...\electrum\electrum\gui\qt\installwizard.py", line 700, in show_xpub_dialog
    layout = SeedLayout(xpub, title=msg, icon=False, for_seed_words=False)
  File "...\electrum\electrum\gui\qt\seed_dialog.py", line 108, in __init__
    self.seed_e = ShowQRTextEdit(config=self.config)
AttributeError: 'SeedLayout' object has no attribute 'config'
2020-12-23 17:34:21 +01:00
SomberNight
731756f6e8 dns hacks: use a default timeout of 30 sec for dns requests
dnspython changed the overall timeout for a request from 30 sec to 5 sec in version 2.0
(see 7ed1648b84 )

5 seconds is not enough in some network conditions...
We manually set the timeout back to 30 sec.

Note that in case these dns hacks are applied, and the timeout is reached,
we fallback to the system dns resolver, which hopefully can get a response.

-----

log was full of:

I | dns_hacks | dnspython failed to resolve dns (AAAA) for 'electrum.org' with error: Timeout('The DNS operation timed out after 5.000827789306641 seconds')
I | dns_hacks | dnspython failed to resolve dns (A) for 'electrum.org' with error: Timeout('The DNS operation timed out after 5.000998020172119 seconds')
I | dns_hacks | dnspython failed to resolve dns (AAAA) for 'electrum.hsmiths.com' with error: Timeout('The DNS operation timed out after 5.000227451324463 seconds')
I | dns_hacks | dnspython failed to resolve dns (A) for 'electrum.hsmiths.com' with error: Timeout('The DNS operation timed out after 5.000523328781128 seconds')
...
2020-12-22 10:48:10 +01:00
ThomasV
f83d2d9fee Move the part of process_gossip that requires access to channel_db into in LNGossip. 2020-12-21 13:33:34 +01:00
ghost43
7ab1a4552b Merge pull request #6867 from SomberNight/202012_wallet_rbf_fixes
wallet: fix bump_fee and dscancel for "not all inputs ismine" case
2020-12-20 14:31:47 +00:00
SomberNight
21f13e21b1 wallet: fix bump_fee and dscancel for "not all inputs ismine" case
we fetch the missing prev txs over network

fixes #6551
fixes #6864
2020-12-20 15:29:41 +01:00
SomberNight
b28b3994c7 qt: move window.get{Open,Save}FileName to util
Sometimes we want its "remember path" behaviour but it does not make sense to
parent the dialog from main window. When so, caller code no longer needs to
get a reference to a main window.

Also rm last usages of get_parent_main_window().
2020-12-20 15:25:35 +01:00
SomberNight
096d853482 qt: rm some usages of get_parent_main_window
instead, pass around the main window or config (whichever is actually needed)

fixes #6342
2020-12-20 15:25:31 +01:00
SomberNight
08c3d2ccd0 lnworker: follow-up 89a14996ce
this fixes running with --offline:

E | gui.qt.exception_window.Exception_Hook | exception caught by crash reporter
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\channels_list.py", line 241, in do_update_rows
    items = [QtGui.QStandardItem(x) for x in self.format_fields(chan)]
  File "...\electrum\electrum\gui\qt\channels_list.py", line 82, in format_fields
    node_alias = self.lnworker.get_node_alias(chan.node_id)
  File "...\electrum\electrum\lnworker.py", line 188, in get_node_alias
    if self.channel_db:
AttributeError: 'LNWallet' object has no attribute 'channel_db'
2020-12-20 15:12:36 +01:00
ThomasV
6daf8b7534 kivy: show exception raised by lnworker.pay. fixes #6495 2020-12-20 11:30:18 +01:00
ThomasV
89a14996ce add method get_node_alias to lnworker 2020-12-19 15:10:15 +01:00
ThomasV
ae15bccb81 prepare release 4.0.9 4.0.9 2020-12-18 19:40:39 +01:00
SomberNight
bb41ef3450 wallet: (fix) bump_fee sometimes created invalid tx that spent orig out
When replacing non-segwit tx, bump_fee in some circumstances created
a tx that tried to spend from the tx-to-be-replaced. There is
explicit logic to avoid this but it only worked for segwit txs.

The change in transaction.py is a no-op, just tried to make it clearer
that the scriptSigs, witnesses are being reset by from_tx().
2020-12-18 19:35:22 +01:00
SomberNight
44e6bfbdd4 travis: disable macOS build 2020-12-18 19:15:45 +01:00
ThomasV
95203b0a55 channels_list: display node_id if node_alias is not available 2020-12-18 14:51:33 +01:00
ThomasV
89ecc85c64 convert_version_24: loop over list instead of dict items (see #6863 and #6349) 2020-12-18 14:30:47 +01:00
ThomasV
c65974b7d0 Merge pull request #6865 from bitromortac/num-sats-can-send-receive
lnchannel: reflect frozen amounts and disconnected peers
2020-12-18 11:25:10 +01:00
ThomasV
b08f9f3581 fix #6859: height is must be passed to OnchainInvoice constructor 2020-12-18 10:49:45 +01:00
bitromortac
7a62074f8e lnchannel: reflect frozen amounts and disconnected channels
in the num_sats_can_send/receive methods of the lnwallet.
2020-12-18 07:09:48 +01:00
ThomasV
d44581e072 prepare release 4.0.8 4.0.8 2020-12-17 17:49:51 +01:00
ThomasV
9fcfa709e0 Merge pull request #6857 from SomberNight/202012_walletdb_v33
wallet_db: impl convert_version_33: put 'height' field into invoices
2020-12-17 17:37:41 +01:00
SomberNight
3a7c00634e wallet_db: impl convert_version_33: put 'height' field into invoices
The 'height' field was added in cdfaaa2609
At the time we thought we could just add it with a default value without a db upgrade;
however the issue is that if old code tries to open a new db, it will fail (due to unexpected new field).
Hence it is better to do an explicit conversion where old code *knows* it cannot open the new db.

E | gui.qt.ElectrumGui |
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\__init__.py", line 257, in start_new_window
    wallet = self.daemon.load_wallet(path, None)
  File "...\electrum\electrum\daemon.py", line 488, in load_wallet
    db = WalletDB(storage.read(), manual_upgrades=manual_upgrades)
  File "...\electrum\electrum\wallet_db.py", line 72, in __init__
    self.load_data(raw)
  File "...\electrum\electrum\wallet_db.py", line 103, in load_data
    self._after_upgrade_tasks()
  File "...\electrum\electrum\wallet_db.py", line 189, in _after_upgrade_tasks
    self._load_transactions()
  File "...\electrum\electrum\util.py", line 408, in <lambda>
    return lambda *args, **kw_args: do_profile(args, kw_args)
  File "...\electrum\electrum\util.py", line 404, in do_profile
    o = func(*args, **kw_args)
  File "...\electrum\electrum\wallet_db.py", line 1139, in _load_transactions
    self.data = StoredDict(self.data, self, [])
  File "...\electrum\electrum\json_db.py", line 79, in __init__
    self.__setitem__(k, v)
  File "...\electrum\electrum\json_db.py", line 44, in wrapper
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\json_db.py", line 105, in __setitem__
    v = self.db._convert_dict(self.path, key, v)
  File "...\electrum\electrum\wallet_db.py", line 1182, in _convert_dict
    v = dict((k, Invoice.from_json(x)) for k, x in v.items())
  File "...\electrum\electrum\wallet_db.py", line 1182, in <genexpr>
    v = dict((k, Invoice.from_json(x)) for k, x in v.items())
  File "...\electrum\electrum\invoices.py", line 108, in from_json
    return OnchainInvoice(**x)
TypeError: __init__() got an unexpected keyword argument 'height'
2020-12-17 15:17:08 +01:00
ThomasV
b80978c8db Merge pull request #6854 from bitromortac/swap-improvements
Swap improvements
2020-12-17 10:41:03 +01:00
bitromortac
64ecf8539a swaps: fix normal amount formulas
In a normal (forward) swap (onchain->offchain):
send_amount = receive_amount * (1 + service_percentage) + normal_fee ,
and vice versa:
receive_amount = (send_amount + normal_fee) / (1 + service_percentage) ,
i.e., the service fee is charged on the received offchain amount.
2020-12-17 07:25:54 +01:00
bitromortac
c377694347 swaps: limit forward amount to receivable amount on lightning 2020-12-17 07:25:48 +01:00
bitromortac
903ad55b0b swaps: disable button if no channel present 2020-12-17 06:50:52 +01:00
SomberNight
ede9b4382a qt swap dialog: attempt at clearer logic (at the cost of more lines)
fixes #6853
2020-12-16 17:17:30 +01:00
SomberNight
f453bfe82e kivy: move "lightning" (gossip) btn inside "channels" dialog
and show toast msg when opening "channels" dialog if lightning
is not available for wallet
2020-12-16 14:22:22 +01:00
ThomasV
06b9d48535 kivy: allow address reuse in imported wallets. (fix #6852) 2020-12-16 12:33:58 +01:00
ThomasV
43614af2c4 wallet: use height to determine request status (similar to outgoing invoices) 2020-12-16 12:25:41 +01:00
ln2max
7fdedd5c40 synchronizer: request missing txs for addresses in random order
as discussed in issue #6697, users with large wallets or slow
connections may never see their initial request-missing-tx run complete,
if we always use the same sync order.

This commit shuffles the addresses being requested every time a new
request round happens, so that (if enough time passes and enough initial
state requests are attempted) we will always get the latest state for
each address, regardless of how quickly the connection times out on us
2020-12-16 11:03:35 +01:00
ln2max
42366ba57d network: increase MOST_RELAXED default timeout to 10 minutes
related: https://github.com/spesmilo/electrum/pull/6741
2020-12-16 11:02:09 +01:00
ghost43
3c89236128 Merge pull request #6843 from SomberNight/202012_distutils_config
build: don't allow setuptools to sneakily install build-time deps
2020-12-15 15:44:39 +00:00
ThomasV
587ca5dd42 kivy: initialize app.android_backups from config, and show error message if save_backup raises an exception 2020-12-15 15:51:06 +01:00
ThomasV
0e420e6f9d lnworker: remove channel if it was not saved successfully after creation 2020-12-15 15:34:26 +01:00
SomberNight
e83f0dd3fc network: when switching servers, don't wait for old interface to close
The GUI blocks until network.set_parameters returns when switching servers,
which waits for switch_to_interface, which used to wait until interface.close()
returns. interface.close() tries to flush buffered writes to the wire, with a
30 sec timeout.

If the server or the network connection is slow, flushing the buffer can take
several seconds. In particular, servers running Fulcrum always seem to
timeout in this case, freezing the GUI for 30 seconds (when switching away).
2020-12-13 18:08:36 +01:00
SomberNight
19f806ddf4 build: don't allow setuptools to sneakily install build-time deps
see https://pip.pypa.io/en/stable/reference/pip_install/#controlling-setup-requires
> Setuptools offers the setup_requires setup() keyword for specifying
> dependencies that need to be present in order for the setup.py
> script to run. Internally, Setuptools uses easy_install to
> fulfill these dependencies.
> pip has no way to control how these dependencies are located.
> None of the package index options have an effect.

With these changes, we will now instead hard fail if this were to happen.

related: https://github.com/spesmilo/electrum/issues/5859#issuecomment-743621898
2020-12-12 02:52:38 +01:00