1
0

13173 Commits

Author SHA1 Message Date
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
ThomasV
91cdd12fa2 Merge pull request #6842 from spesmilo/save_height_in_invoices
Save height in invoices, use it to determine invoice status
2020-12-11 19:56:59 +01:00
ThomasV
cdfaaa2609 Save height in invoices, use it to determine invoice status (fixes #6609) 2020-12-11 19:55:56 +01:00
SomberNight
a83805e00b tweak electrum-env script
- set -e, and don't call deactivate (not needed; and with -e
  if ./run_electrum errors it wouldn't run anyway)
- re PYTHONPATH
    - I think the sane thing is to give priority to the virtualenv,
      and only use system-packages as a fallback
    - added more paths; tested that it now works for modern Ubuntu
      and Manjaro
- use "python3 -m venv" instead of "virtualenv"
  (as former is always(?) available now)
2020-12-11 15:53:33 +01:00
SomberNight
c81551299e transaction: put full derivation paths into PSBT by default
There are three export options for exporting a PSBT.
The default option previously only put derivation path suffixes for pubkeys
(paths relative to the intermediate xpub), now it puts the full path
(if is known by the keystore).

The "export for hardware device; include xpubs" option works same as before:
it puts both full paths and also global xpubs into the PSBT.
Hence the difference between the default option and the "include xpubs" option
is now only that the latter puts global xpubs into the PSBT.

This change is largely made for user-convenient in mind.
Now exporting a PSBT should be less error-prone: particularly for the
single-signer coldcard with sdcard usage, the default option will now work.

closes #5969
related #5955
2020-12-10 17:39:12 +01:00
SomberNight
c3c64a37c2 keystore: ignore fingerprint for pubkeys in psbt, try to match all keys 2020-12-10 17:39:07 +01:00
ThomasV
8872e43f27 cleanup, remove if statement (follow-up 13b05f64e6) 2020-12-10 17:21:41 +01:00
ThomasV
567130f4a3 Merge pull request #6838 from SomberNight/202012_seed_type_old_2fa
mnemonic: tighten seed_type check for old "2fa" type seeds
2020-12-10 14:43:29 +01:00
SomberNight
d1302d3384 mnemonic: tighten seed_type check for old "2fa" type seeds
Seeds in the set difference could already not be restored: they raised
an exception in the wizard; now these are not recognised as valid seeds
anymore (so e.g. OK button in wizard will be disabled).
Also see comments in code.
2020-12-10 14:36:31 +01:00
SomberNight
4bda6f5e61 test_wallet_vertical: add test case for pre-2.7 "2fa" seed 2020-12-10 14:35:10 +01:00
ThomasV
093a03ebcf Merge pull request #6836 from SomberNight/202012_kivy_fix_paths
kivy: fix some resource path issues
2020-12-10 11:01:02 +01:00
SomberNight
9e45108395 kivy: fix some resource path issues
When running kivy on Linux desktop,
running from git clone, `./run_electrum -g kivy` worked,
but `pip install -e .; electrum -g kivy` did not.
This was due to the relative paths using cwd as base.

see #6835
2020-12-10 07:30:31 +01:00
ThomasV
b6f63e1abf kivy: dismiss wizard dialog before calling go_back 2020-12-09 19:10:51 +01:00
SomberNight
1851ec962f trustedcoin: fix two-step wallet creation (offline->online)
got broken in c46fbf08a5
2020-12-09 18:31:08 +01:00
ghost43
e3ea0f6241 Merge pull request #6736 from SomberNight/202011_appimage_build
appimage build: build most of our python dependencies from source
2020-12-09 16:35:22 +00:00
SomberNight
4ca2a5cf3e appimage build: build most of our python dependencies from source
instead of using pre-built binary wheels from PyPI
2020-12-09 16:38:03 +01:00
SomberNight
e0917d12f6 rerun freeze_packages 2020-12-09 16:37:59 +01:00
SomberNight
d40bedb2ac also support uppercase bip21 URIs
related https://github.com/btcpayserver/btcpayserver/issues/2110
2020-12-09 16:09:12 +01:00
SomberNight
37a124fa1c appimage: update package in dockerfile 4.0.7 2020-12-09 15:00:42 +01:00
ThomasV
4fdeeb224e update locale 2020-12-09 14:20:34 +01:00
ThomasV
0e0cb57c73 update locale 2020-12-09 14:19:04 +01:00
ThomasV
f396ae0a29 prepare 4.0.7 2020-12-09 14:10:50 +01:00
ghost43
b4cc420d0a Merge pull request #6300 from SomberNight/202006_qt_statusbarbutton
qt StatusBarButton: use QToolButton instead of QPushButton
2020-12-09 12:42:23 +00:00
SomberNight
5b9c972499 qt StatusBarButton: use custom theme for macOS if using default theme 2020-12-09 12:41:19 +01:00
SomberNight
6f14375a68 qt StatusBarButton: use QToolButton instead of QPushButton
related: #6299
2020-12-09 12:15:55 +01:00
ThomasV
07bc4c40ef kivy: add on_dismiss method to crash reporter dialog 2020-12-09 10:22:42 +01:00
ThomasV
9ddb675550 kivy: handle lightning invoices on wallets that do not have lightning. fix #6371 2020-12-09 10:04:49 +01:00
SomberNight
ac223073ba keystore: handle unusual derivation paths in PSBT
If a tx contained a derivation path for a pubkey,
with a length=2 der suffix,
with the first element of the suffix not in (0, 1),
with a fingerprint that matches either our root or intermediate fp,
then processing that tx would raise and result in a crash reporter.

Traceback (most recent call last):
  File ".../electrum/electrum/gui/qt/main_window.py", line 2718, in do_process_from_text
    self.show_transaction(tx)
  File ".../electrum/electrum/gui/qt/main_window.py", line 1041, in show_transaction
    show_transaction(tx, parent=self, desc=tx_desc)
  File ".../electrum/electrum/gui/qt/transaction_dialog.py", line 84, in show_transaction
    d = TxDialog(tx, parent=parent, desc=desc, prompt_if_unsaved=prompt_if_unsaved)
  File ".../electrum/electrum/gui/qt/transaction_dialog.py", line 680, in __init__
    self.set_tx(tx)
  File ".../electrum/electrum/gui/qt/transaction_dialog.py", line 218, in set_tx
    tx.add_info_from_wallet(self.wallet)
  File ".../electrum/electrum/transaction.py", line 1944, in add_info_from_wallet
    wallet.add_input_info(txin, only_der_suffix=only_der_suffix)
  File ".../electrum/electrum/wallet.py", line 1573, in add_input_info
    is_mine = self._learn_derivation_path_for_address_from_txinout(txin, address)
  File ".../electrum/electrum/wallet.py", line 2609, in _learn_derivation_path_for_address_from_txinout
    pubkey, der_suffix = ks.find_my_pubkey_in_txinout(txinout, only_der_suffix=True)
  File ".../electrum/electrum/keystore.py", line 155, in find_my_pubkey_in_txinout
    path = self.get_pubkey_derivation(pubkey, txinout, only_der_suffix=only_der_suffix)
  File ".../electrum/electrum/keystore.py", line 391, in get_pubkey_derivation
    if not test_der_suffix_against_pubkey(der_suffix, pubkey):
  File ".../electrum/electrum/keystore.py", line 368, in test_der_suffix_against_pubkey
    if pubkey != self.derive_pubkey(*der_suffix):
  File ".../electrum/electrum/keystore.py", line 491, in derive_pubkey
    assert for_change in (0, 1)
AssertionError
2020-12-09 09:42:51 +01:00
ThomasV
0c3f360385 Merge pull request #6832 from SomberNight/202012_fix_qt_swap_dialog_ok_btn
qt swap dialog: fix enabling OK button
2020-12-09 09:28:16 +01:00
SomberNight
8c5601a172 dnspython: fix deprecation warnings when using dnspython 2.0
related: #6828
2020-12-09 09:04:04 +01:00
SomberNight
2ebd844b31 qt swap dialog: fix enabling OK button
fixes #6831
2020-12-09 08:20:46 +01:00
ThomasV
6273b4808f kivy: ensure WizardDialog.on_release is not executed more than once (see #6822) 2020-12-08 19:42:21 +01:00
ghost43
201ffa210e Merge pull request #6828 from SomberNight/202012_dnspython20
dependencies: require dnspython 2.0, require cryptography 2.6, drop python-ecdsa
2020-12-08 16:30:29 +00:00