1
0
Commit Graph

16458 Commits

Author SHA1 Message Date
SomberNight
09b9fb8374 exchange_rate: try harder to refresh quote when cache is expiring
Previously we polled every 2.5 minutes to get the fx spot price,
and had a 10 minute cache expiry during which the latest spot price
was valid.

On Android, this often resulted in having no price available (showing
"No data" in GUI) when putting the app in the foreground after e.g.
a half-hour sleep in the background: often there would be no fx price
until the next tick, which could take 2.5 minutes. (btw in some cases
I saw the application trying to get new quotes from the network as
soon as the app was put in the foreground but it seems those happened
so fast that the network was not ready yet and DNS lookups failed)

Now we make the behaviour a bit more complex: we still fetch the price
every 2.5 mins, and the cache is still valid for 10 mins, however if
the last price is >7.5 mins old, we become more aggressive and go into
an exponential backoff, initially trying a request every few seconds.
For the Android scenario, this means there might be "No data" for fx
for a few seconds after a long sleep, however if there is a working
network, it should soon get a fresh fx spot price quote.
2023-06-14 15:42:28 +00:00
SomberNight
03615c2cfc commands: onchain_history: reuse daemon.fx if available 2023-06-14 15:05:26 +00:00
SomberNight
87cba8bf32 trustedcoin: stricter client-side checks for 2fa fee 2023-06-13 16:52:50 +00:00
SomberNight
23f2412da7 qt: follow-up "rm thousand sep when copying numbers to clipboard"
follow-up https://github.com/spesmilo/electrum/pull/8479
2023-06-13 15:59:18 +00:00
ThomasV
5b5100eedc Merge pull request #8479 from thomasleveil/feat_copy_numbers
 remove thousand separator when copying numbers to clipboard
2023-06-13 14:40:17 +02:00
SomberNight
703ec09355 addr_sync: expand docstring for get_tx_fee 2023-06-13 00:24:56 +00:00
Thomas LÉVEIL
1b07472805 🐛 fix #8469 - fiat balance sorting (#8478)
in address list window
2023-06-12 22:39:31 +00:00
Thomas
cdab59f620 remove thousand separator when copying numbers to clipboard
from contextual menus
2023-06-11 23:55:10 +02:00
SomberNight
3ab47e1c45 (trivial) convert more config keys 2023-06-05 15:29:35 +00:00
SomberNight
033ad0feb9 lnworker: fix rebalance_channels
fixes https://github.com/spesmilo/electrum/issues/8468
2023-06-04 03:07:06 +00:00
SomberNight
9b14b87936 win build: tighten pip install with --no-binary somewhat
related https://github.com/spesmilo/electrum/pull/7918
2023-06-02 23:12:36 +00:00
SomberNight
48a8311849 mac build: bump pyinstaller (5.3->5.11) 2023-06-02 23:04:42 +00:00
SomberNight
e455677284 win build: bump pyinstaller (4.10->5.11)
In `build-electrum-git.sh`, the `-w` CLI arg is removed: it was apparently ignored as we are using a .spec file,
and pyinstaller 5.0+ is now raising a hard error (see https://github.com/pyinstaller/pyinstaller/issues/6660).
```
option(s) not allowed:
  --console/--nowindowed/--windowed/--noconsole
makespec options not valid when a .spec file is given
```

-----

In ecc_fast.py, we don't sys.exit() anymore as pyinstaller 5.0+ tries to import electrum during the Analysis phase.
see https://github.com/pyinstaller/pyinstaller/pull/6171

```
57912 INFO: Looking for dynamic libraries
1746 INFO: gettext setting initial language to None
1932 ERROR: libsecp256k1 library failed to load. exceptions: [FileNotFoundError("Could not find module 'C:\\python3\\lib\\site-packages\\electrum\\libsecp256k1-2.dll' (or one of its depende
ncies). Try using the full path with constructor syntax."), FileNotFoundError("Could not find module 'C:\\python3\\lib\\site-packages\\electrum\\libsecp256k1-1.dll' (or one of its dependenc
ies). Try using the full path with constructor syntax."), FileNotFoundError("Could not find module 'C:\\python3\\lib\\site-packages\\electrum\\libsecp256k1-0.dll' (or one of its dependencie
s). Try using the full path with constructor syntax."), FileNotFoundError("Could not find module 'libsecp256k1-2.dll' (or one of its dependencies). Try using the full path with constructor
syntax."), FileNotFoundError("Could not find module 'libsecp256k1-1.dll' (or one of its dependencies). Try using the full path with constructor syntax."), FileNotFoundError("Could not find
module 'libsecp256k1-0.dll' (or one of its dependencies). Try using the full path with constructor syntax.")]
Traceback (most recent call last):
  File "C:\python3\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\python3\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\python3\scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "C:\python3\lib\site-packages\PyInstaller\__main__.py", line 194, in _console_script_run
    run()
  File "C:\python3\lib\site-packages\PyInstaller\__main__.py", line 180, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\python3\lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\python3\lib\site-packages\PyInstaller\building\build_main.py", line 1006, in main
    build(specfile, distpath, workpath, clean_build)
  File "C:\python3\lib\site-packages\PyInstaller\building\build_main.py", line 928, in build
    exec(code, spec_namespace)
  File "deterministic.spec", line 55, in <module>
    a = Analysis([home+'run_electrum',
  File "C:\python3\lib\site-packages\PyInstaller\building\build_main.py", line 428, in __init__
    self.__postinit__()
  File "C:\python3\lib\site-packages\PyInstaller\building\datastruct.py", line 184, in __postinit__
    self.assemble()
  File "C:\python3\lib\site-packages\PyInstaller\building\build_main.py", line 736, in assemble
    isolated.call(find_binary_dependencies, self.binaries, self.binding_redirects, collected_packages)
  File "C:\python3\lib\site-packages\PyInstaller\isolated\_parent.py", line 372, in call
    return isolated.call(function, *args, **kwargs)
  File "C:\python3\lib\site-packages\PyInstaller\isolated\_parent.py", line 302, in call
    raise RuntimeError(f"Child process call to {function.__name__}() failed with:\n" + output)
RuntimeError: Child process call to find_binary_dependencies() failed with:
  File "C:\python3\lib\site-packages\PyInstaller\isolated\_child.py", line 63, in run_next_command
    output = function(*args, **kwargs)
  File "C:\python3\lib\site-packages\PyInstaller\building\build_main.py", line 177, in find_binary_dependencies
    __import__(package)
  File "C:\python3\lib\site-packages\electrum\__init__.py", line 20, in <module>
    from .wallet import Wallet
  File "C:\python3\lib\site-packages\electrum\wallet.py", line 53, in <module>
    from .bip32 import BIP32Node, convert_bip32_intpath_to_strpath, convert_bip32_strpath_to_intpath
  File "C:\python3\lib\site-packages\electrum\bip32.py", line 11, in <module>
    from . import constants
  File "C:\python3\lib\site-packages\electrum\constants.py", line 30, in <module>
    from . import bitcoin
  File "C:\python3\lib\site-packages\electrum\bitcoin.py", line 35, in <module>
    from . import ecc
  File "C:\python3\lib\site-packages\electrum\ecc.py", line 39, in <module>
    from .ecc_fast import _libsecp256k1, SECP256K1_EC_UNCOMPRESSED
  File "C:\python3\lib\site-packages\electrum\ecc_fast.py", line 151, in <module>
    sys.exit(f"Error: Failed to load libsecp256k1.")
SystemExit: Error: Failed to load libsecp256k1.
🗯 ERROR: build-electrum-git failed
```

Also, the -OO flag is removed from wine python, for similar reasons:
pyinstaller imports electrum, and in electrum/__init__.py, we raise
if -O is used: 9b1fb0e5fe/electrum/__init__.py (L40)
2023-06-02 22:37:43 +00:00
SomberNight
98f240d6cd commands: version_info: include python version/path 2023-06-02 21:48:28 +00:00
SomberNight
9b1fb0e5fe android build: bump python, openssl 2023-06-02 17:17:43 +00:00
SomberNight
6442dbb021 mac build: bump python version (3.9.13->3.10.11) 2023-06-02 17:17:40 +00:00
SomberNight
16c3c3c4c0 appimage build: bump python version (3.9.15->3.10.11) 2023-06-02 17:17:36 +00:00
SomberNight
21cf85afca win build: bump python version (3.9.13->3.10.11) 2023-06-02 17:17:33 +00:00
SomberNight
66f219cdf3 win build: update wine 2023-06-02 17:17:30 +00:00
SomberNight
3a1c4299ca build: bump libusb version 2023-06-02 17:17:26 +00:00
SomberNight
a1c24c6261 jade(hw): fix sign_transaction()
same as 9e13246be8

fixes https://github.com/spesmilo/electrum/issues/8463
regression from https://github.com/spesmilo/electrum/pull/8230
2023-06-02 13:48:48 +00:00
Sander van Grieken
2a4d2ac009 payserver: fix import 2023-06-02 13:35:51 +02:00
Sander van Grieken
8cd95f1f7f qml: limit BIP39 cosigners script type to initial choice (bip39) or initial seed (electrum) 2023-06-02 09:46:53 +02:00
SomberNight
eba3282024 fix flake8: follow-up prev 2023-06-01 22:59:40 +00:00
SomberNight
ccc012674f unconditionally raise ImportError if asserts are disabled
I have reconsidered and now think that we should always hard-fail
if asserts asserts are disabled. It is just easier to reason about
the code knowing that asserts are evaluated.

If an end-user or library user has a concrete use case where this is
a problem, please open an issue and let us know.

follow-up
0f541be6f1
0e5464ca13
2023-06-01 17:34:32 +00:00
SomberNight
bd5a786262 update release notes for version 4.4.4 2023-05-31 13:01:32 +00:00
SomberNight
22919bc15c update locale 2023-05-31 12:50:32 +00:00
SomberNight
1c0ba83d10 (trivial) qt wizard: add title to seed options dialog window 2023-05-31 10:58:54 +00:00
Sander van Grieken
6fbe765a3e qml: make ConfirmTxDialog flickable if content larger than window (fixes #8446) 2023-05-31 11:29:14 +02:00
ghost43
2f769d4015 Merge pull request #8459 from benma/bitbox02-6.2.0
bitbox02: update to 6.2.0 to fix a bug on macOS 13.3, and ability to display amount in sats on the device
2023-05-30 23:35:52 +00:00
SomberNight
f284b42fa8 build: update pinned bitbox02 (partial rerun freeze_packages) 2023-05-30 23:34:46 +00:00
SomberNight
184281d2fc version_info cmd: better version for hidapi
was added in https://github.com/trezor/cython-hidapi/pull/143
2023-05-30 22:54:26 +00:00
SomberNight
1b9cb47623 dependencies: rm upper limit for hidapi
Was added in 752b37a03b,
due to upstream issue https://github.com/trezor/cython-hidapi/issues/142,
which should now be fixed in 0.14.0.
2023-05-30 22:51:06 +00:00
Marko Bencun
dfed0ef54a bitbox02: display amounts in sats if Electrum's base unit is sat
The BitBox02 has the ability to display all amounts in sats instead of
BTC. This was introduced in v9.13.0. If Electrum is configured to show
sats, we propagate this config to the BitBox02.

This is backwards compatible: users with older firmware will see the
values in BTC regardless of the config.
2023-05-30 23:57:03 +02:00
Marko Bencun
7164f9fd6e bitbox02: update to 6.2.0
6.2.0 was released to put a minimum requirement on hidapi 0.14.0,
which includes the fix for this issue:

https://github.com/libusb/hidapi/issues/531

That bug caused hidapi on macOS 13.3 to report 0 as the interface
number for all hid devices, which led to the bitbox02 multi edition being listed
twice instead of once - once for the main HW wallet interface and once erroneously
For the U2F interface (which should not be listed).
2023-05-30 23:55:52 +02:00
ghost43
b6cfc12962 Merge pull request #8454 from SomberNight/202305_configvar
config: introduce ConfigVars (take 3)
2023-05-30 14:52:50 +00:00
SomberNight
328a2bb3f2 config: migrate qt gui optional tabs to config vars 2023-05-30 14:04:20 +00:00
SomberNight
dfa2b71bc3 config: trivial rename for better readability 2023-05-30 14:04:17 +00:00
SomberNight
c049b461bb bump libsecp256k1 version 2023-05-26 13:22:35 +00:00
SomberNight
24980feab7 config: introduce ConfigVars
A new config API is introduced, and ~all of the codebase is adapted to it.
The old API is kept but mainly only for dynamic usage where its extra flexibility is needed.

Using examples, the old config API looked this:
```
>>> config.get("request_expiry", 86400)
604800
>>> config.set_key("request_expiry", 86400)
>>>
```

The new config API instead:
```
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS
604800
>>> config.WALLET_PAYREQ_EXPIRY_SECONDS = 86400
>>>
```

The old API operated on arbitrary string keys, the new one uses
a static ~enum-like list of variables.

With the new API:
- there is a single centralised list of config variables, as opposed to
  these being scattered all over
- no more duplication of default values (in the getters)
- there is now some (minimal for now) type-validation/conversion for
  the config values

closes https://github.com/spesmilo/electrum/pull/5640
closes https://github.com/spesmilo/electrum/pull/5649

Note: there is yet a third API added here, for certain niche/abstract use-cases,
where we need a reference to the config variable itself.
It should only be used when needed:
```
>>> var = config.cv.WALLET_PAYREQ_EXPIRY_SECONDS
>>> var
<ConfigVarWithConfig key='request_expiry'>
>>> var.get()
604800
>>> var.set(3600)
>>> var.get_default_value()
86400
>>> var.is_set()
True
>>> var.is_modifiable()
True
```
2023-05-25 17:39:48 +00:00
SomberNight
03ab33f4b2 SimpleConfig: change API of set_key(): "save" is now kwarg-only 2023-05-25 17:37:16 +00:00
ThomasV
250b14cb6e Merge pull request #8450 from SomberNight/202305_website_nojs
contrib/make_download: adapt to downloads being merged into index.html
2023-05-24 15:51:46 +02:00
SomberNight
3861b7c152 contrib/make_download: adapt to downloads being merged into index.html
see https://github.com/spesmilo/electrum-web/pull/20
2023-05-22 13:12:26 +00:00
ThomasV
fda408e4e4 Merge pull request #8444 from Har01d/add-3xpl-as-explorer
Add 3xpl.com to the list of explorers
2023-05-21 11:17:21 +02:00
SomberNight
603088a79f util: simplify profiler 2023-05-19 23:03:27 +00:00
Nikita Zhavoronkov
9f045e546f Add 3xpl.com to the list of explorers 2023-05-20 04:29:44 +06:00
SomberNight
e9475345e4 qml wizard: "confirm seed" screen to normalize whitespaces
fixes https://github.com/spesmilo/electrum/issues/8442
2023-05-17 15:19:41 +00:00
SomberNight
fd41308c6b network: log original error text in catch_server_exceptions
related: https://github.com/spesmilo/electrum/issues/8439
2023-05-16 15:10:12 +00:00
SomberNight
fc7c5dde6e qt SwapDialog: propagate errors from _create_tx
fixes https://github.com/spesmilo/electrum/issues/8430
2023-05-16 14:41:26 +00:00
accumulator
ac8a7a0784 channel_db: raise specific exception when channelDB not loaded, allowing lnworker to mark payment as failed. (#8431)
On mobile, it can take a while before channelDB is loaded. If payment is attempted before the DB
is fully loaded, this would result in a payment failure, but also leaves the payment attempt in IN_PROGRESS
state. This patch adds a more specific ChannelDBNotLoaded exception class, so we can handle this case more
gracefully, since we know the payment didn't succeed.
2023-05-16 13:08:26 +00:00