1
0
Commit Graph

15349 Commits

Author SHA1 Message Date
SomberNight
785023d458 release process: split release.sh into two
This allows the add_cosigner workflow to be done before the website links to new binaries.
(so Emzy or other builders can try to reproduce builds and add signatures before new binaries are fully live)
2023-01-26 15:56:35 +01:00
ThomasV
027dbe2d15 payserver: add 'view in payserver' menu item 2023-01-26 15:33:11 +01:00
ThomasV
0dff0cb639 payserver plugin improvements 2023-01-26 15:31:41 +01:00
ThomasV
a526aa3b2b update payserver submodule 2023-01-26 15:31:24 +01:00
SomberNight
63a811d8f0 manually rerun freeze_packages, restricted to fix known CVEs only 2023-01-25 16:00:24 +00:00
SomberNight
e854d2371a CLI: make "electrum stop" robust to dead daemon / lingering lockfile
follow-up fbf79b148b
2023-01-25 15:46:00 +00:00
ThomasV
fbbd07343b update payserver www submodule 2023-01-25 14:56:00 +00:00
sorenstoutner
85355cb7d7 Add an AppStream metainfo.xml file
AppStream metainfo.xml files are like extended .desktop files used to populate app stores with information about GUI applications.  Debian and Ubunto and other major Linux distributions are starting to push for their inclusions.  This is a fairly minimal example that just covers the required entries.  The text for the description is a slightly modified version of text taken from Electrum's FAQ.

Metainfo files can contain links to screenshots.  I have not included any here, but that might be something someone would like to add in the future.
2023-01-25 14:54:32 +00:00
ThomasV
c7e2125f48 CLI: poor man's detection of already running daemon. 2023-01-25 14:53:55 +00:00
ThomasV
24c5df2907 channel_db: protect load_db against raw messages that can no longer be parsed 2023-01-25 14:53:16 +00:00
ThomasV
01d1c36bcc Use different trampoline bits than Eclair. Fixes #8141 2023-01-25 14:52:51 +00:00
SomberNight
3e67cba73e follow-up prev: fix tests 2023-01-25 14:52:31 +00:00
SomberNight
95d1064e8b lnmsg: add details to FailedToParseMsg, log message type
note: Would it be ok to log potentially secret (semi-sensitive) data?
We take care not to log onchain private keys as they are extremely sensitive,
but what about logging a LN transport message that might contain channel secrets?
Decided not to, for now.
2023-01-25 14:52:15 +00:00
ThomasV
5251e7f83a Increase trampoline fee if we receive TEMPORARY_CHANNEL_FAILURE
Sometimes the trampoline node fails to send a payment and returns
TEMPORARY_CHANNEL_FAILURE, while it succeeds with a higher trampoline
fee. My guess is that the initial fee was not sufficient to try
all routes, and that a higher fee allows to use extra routes. I
suppose it would make more sense if the trampoline node returned
TRAMPOLINE_FEE_INSUFFICIENT in that case.
2023-01-25 14:51:32 +00:00
SomberNight
89407252e1 payserver: daemon._run should only be called once 2023-01-25 14:51:16 +00:00
SomberNight
fe62172c41 payserver: make daemon_wallet_loaded hook reliable
daemon.load_wallet() often early-returns,
e.g. in Qt case, for storage-encrypted wallets.

closes https://github.com/spesmilo/electrum/issues/8118
2023-01-25 14:50:58 +00:00
MrNaif2018
04ffe1ddda Return list of tx hashes for partially paid invoices too 2023-01-25 14:50:03 +00:00
SomberNight
2b4f77da3e wallet.get_request_by_addr: make deterministic
This makes test_invoices/test_wallet_get_request_by_addr pass without flakyness.

closes https://github.com/spesmilo/electrum/issues/8113
2023-01-25 14:49:21 +00:00
SomberNight
52e2da3ab0 wallet: fix deadlock in on_event_adb_added_verified_tx
wallet.lock -> wallet.transaction_lock order must be respected.

deadlock example:
```
# ThreadID: 19100
File: ...\Python\Python310\lib\threading.py", line 966, in _bootstrap
  self._bootstrap_inner()
File: ...\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
  self.run()
File: ...\Python\Python310\lib\threading.py", line 946, in run
  self._target(*self._args, **self._kwargs)
File: "...\electrum\electrum\util.py", line 1552, in run_event_loop
  loop.run_until_complete(stopping_fut)
File: ...\Python\Python310\lib\asyncio\base_events.py", line 633, in run_until_complete
  self.run_forever()
File: ...\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
  super().run_forever()
File: ...\Python\Python310\lib\asyncio\base_events.py", line 600, in run_forever
  self._run_once()
File: ...\Python\Python310\lib\asyncio\base_events.py", line 1896, in _run_once
  handle._run()
File: ...\Python\Python310\lib\asyncio\events.py", line 80, in _run
  self._context.run(self._callback, *self._args)
File: "...\electrum\electrum\wallet.py", line 494, in on_event_adb_added_verified_tx
  self._update_invoices_and_reqs_touched_by_tx(tx_hash)
File: "...\electrum\electrum\wallet.py", line 2454, in _update_invoices_and_reqs_touched_by_tx
  status = self.get_invoice_status(request)
File: "...\electrum\electrum\wallet.py", line 2333, in get_invoice_status
  paid, conf = self.is_onchain_invoice_paid(invoice)
File: "...\electrum\electrum\wallet.py", line 1120, in is_onchain_invoice_paid
  is_paid, conf_needed, relevant_txs = self._is_onchain_invoice_paid(invoice)
File: "...\electrum\electrum\wallet.py", line 1095, in _is_onchain_invoice_paid
  with self.lock, self.transaction_lock:
File: "...\electrum\electrum\address_synchronizer.py", line 70, in acquire
  return self._lock.acquire(*args, **kwargs)

# ThreadID: 20040
File: "C:\Program Files\JetBrains\PyCharm Community Edition 2021.3.3\plugins\python-ce\helpers\pycharm\_jb_pytest_runner.py", line 51, in <module>
  sys.exit(pytest.main(args, plugins_to_load + [Plugin]))
File: "...\Python\Python310\site-packages\_pytest\config\__init__.py", line 164, in main
  ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
File: ...\Python\Python310\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
  return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
  return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
  res = hook_impl.function(*args)
File: "...\Python\Python310\site-packages\_pytest\main.py", line 315, in pytest_cmdline_main
  return wrap_session(config, _main)
File: "...\Python\Python310\site-packages\_pytest\main.py", line 268, in wrap_session
  session.exitstatus = doit(config, session) or 0
File: "...\Python\Python310\site-packages\_pytest\main.py", line 322, in _main
  config.hook.pytest_runtestloop(session=session)
File: ...\Python\Python310\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
  return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
  return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
  res = hook_impl.function(*args)
File: "...\Python\Python310\site-packages\_pytest\main.py", line 347, in pytest_runtestloop
  item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
File: ...\Python\Python310\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
  return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
  return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
  res = hook_impl.function(*args)
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 111, in pytest_runtest_protocol
  runtestprotocol(item, nextitem=nextitem)
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 130, in runtestprotocol
  reports.append(call_and_report(item, "call", log))
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 219, in call_and_report
  call = call_runtest_hook(item, when, **kwds)
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 258, in call_runtest_hook
  return CallInfo.from_call(
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 338, in from_call
  result: Optional[TResult] = func()
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 259, in <lambda>
  lambda: ihook(item=item, **kwds), when=when, reraise=reraise
File: ...\Python\Python310\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
  return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
  return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File: ...\Python\Python310\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
  res = hook_impl.function(*args)
File: "...\Python\Python310\site-packages\_pytest\runner.py", line 166, in pytest_runtest_call
  item.runtest()
File: "...\Python\Python310\site-packages\_pytest\unittest.py", line 327, in runtest
  self._testcase(result=self)  # type: ignore[arg-type]
File: ...\Python\Python310\lib\unittest\case.py", line 650, in __call__
  return self.run(*args, **kwds)
File: ...\Python\Python310\lib\unittest\case.py", line 591, in run
  self._callTestMethod(testMethod)
File: ...\Python\Python310\lib\unittest\case.py", line 549, in _callTestMethod
  method()
File: "...\electrum\electrum\tests\test_invoices.py", line 120, in test_wallet_without_ln_creates_payreq_and_gets_paid_onchain
  self.assertEqual(PR_PAID, wallet1.get_invoice_status(pr))
File: "...\electrum\electrum\wallet.py", line 2333, in get_invoice_status
  paid, conf = self.is_onchain_invoice_paid(invoice)
File: "...\electrum\electrum\wallet.py", line 1120, in is_onchain_invoice_paid
  is_paid, conf_needed, relevant_txs = self._is_onchain_invoice_paid(invoice)
File: "...\electrum\electrum\wallet.py", line 1095, in _is_onchain_invoice_paid
  with self.lock, self.transaction_lock:
File: "...\electrum\electrum\address_synchronizer.py", line 70, in acquire
  return self._lock.acquire(*args, **kwargs)
```
2023-01-25 14:48:44 +00:00
SomberNight
77dcff0537 util: create_and_start_event_loop() to wait until loop starts
With a PyCharm debugger attached, sometimes the python process is so
CPU-starved for me that create_and_start_event_loop() returned
before the event loop actually started, resulting in weird errors.
I guess this could happen even without a debugger attached on a
sufficiently slow CPU.

```
...\electrum\electrum\wallet.py:3580: in restore_wallet_from_text
    wallet = Wallet(db, storage, config=config)
...\electrum\electrum\wallet.py:3501: in __new__
    wallet = WalletClass(db, storage, config=config)
...\electrum\electrum\wallet.py:3345: in __init__
    Deterministic_Wallet.__init__(self, db, storage, config=config)
...\electrum\electrum\wallet.py:3135: in __init__
    self.synchronize()
...\electrum\electrum\wallet.py:3283: in synchronize
    count += self.synchronize_sequence(False)
...\electrum\electrum\wallet.py:3267: in synchronize_sequence
    self.create_new_address(for_change)
...\electrum\electrum\wallet.py:3254: in create_new_address
    self.adb.add_address(address)
...\electrum\electrum\address_synchronizer.py:213: in add_address
    self.up_to_date_changed()
...\electrum\electrum\address_synchronizer.py:680: in up_to_date_changed
    util.trigger_callback('adb_set_up_to_date', self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <electrum.util.CallbackManager object at 0x000002B1788AD6F0>
event = 'adb_set_up_to_date'
args = (<electrum.address_synchronizer.AddressSynchronizer object at 0x000002B17A687670>,)

    def trigger_callback(self, event, *args):
        """Trigger a callback with given arguments.
        Can be called from any thread. The callback itself will get scheduled
        on the event loop.
        """
        if self.asyncio_loop is None:
            self.asyncio_loop = get_asyncio_loop()
>           assert self.asyncio_loop.is_running(), "event loop not running"
E           AssertionError: event loop not running

...\electrum\electrum\util.py:1734: AssertionError
```
2023-01-25 14:48:29 +00:00
myxmaster
d47e734cfa update status bar when setting "zeros after decimal point" is changed 2023-01-25 14:46:42 +00:00
ThomasV
df935a6fdf make lnwatcher less spammy 2023-01-25 14:44:02 +00:00
SomberNight
9ea705dadc prepare release 4.3.3 4.3.3 2023-01-02 15:35:37 +00:00
SomberNight
764aea4434 update locale 2023-01-02 15:32:19 +00:00
SomberNight
85ec4b2f61 qt gui: display nice error if QR code data overflows
there is existing handler-code at e.g.
1a7634e615/electrum/gui/qt/transaction_dialog.py (L309)
but we should make sure setData() always raises the exc when needed,
as paintEvent() is too late for nice handling.

closes https://github.com/spesmilo/electrum/issues/4288
closes https://github.com/spesmilo/electrum/issues/4280
2023-01-02 14:07:58 +00:00
SomberNight
459a7e2eaa cirrus CI: disable macOS builds, as no more intel-based mac workers
related https://cirrus-ci.org/blog/2022/11/08/sunsetting-intel-macos-instances/
2023-01-02 14:07:54 +00:00
SomberNight
23cb6f5f78 build: use $CIRRUS_CPU to determine cpu count on CI
related https://github.com/cirruslabs/cirrus-ci-docs/issues/1115
2023-01-02 14:07:51 +00:00
SomberNight
8e183d3bef qt network dialog: don't poll Tor socks proxy, but scan on interaction
Polling is introduces spam in Tor logs.
Also, Tor Browser 12.0 apparently has a bug where our polling renders
the socks proxy unusuable after some time.
see https://gitlab.torproject.org/tpo/applications/tor-browser/-/issues/41549

Instead of trying to detect a Tor socks proxy every 10 seconds, we now
run detection when the Qt network dialog gets opened, and also when
the user switches to the "Proxy" tab in the dialog.

fixes https://github.com/spesmilo/electrum/issues/7317
2023-01-02 14:07:47 +00:00
SomberNight
b926f11702 qt gui: handle swap server unreachable
note: testnet swap server is offline atm
closes https://github.com/spesmilo/electrum/issues/8107
2023-01-02 14:07:43 +00:00
SomberNight
67f0f90e8d bitcoin: trivial speedup for DecodeBase58Check (down to ~80% time) 2023-01-02 14:06:49 +00:00
SomberNight
9bbb1f24e5 simplify prev 2023-01-02 14:06:14 +00:00
SomberNight
e58501a3fe logging: add a relative timestamp to stderr console logs
In the past we decided not to put a timestamp into the stderr logs
to have shorter log lines (to save column width in a terminal).
However over time I at least have found that it would be valuable
to have timestamps also in the stderr - e.g. when users provide logs.
Often I am only interested in the time taken between logged events,
so as a compromise to still save some length, I propose adding relative
timestamps (relative to process startup time).

Compare these log lines from the file logger:

```
20220816T120601.882003Z |     INFO | gui.qt.ElectrumGui | starting Qt main loop
20220816T120601.905619Z |     INFO | gui.qt.history_list.HistoryModel | refreshing... reason: update_tabs
20220816T120601.911908Z |    DEBUG | util.profiler | Abstract_Wallet.get_full_history 0.0059 sec
20220816T120602.095670Z |     INFO | interface.[testnet.hsmiths.com:53012] | connection established. version: ['ElectrumX 1.16.0', '1.4']
```
With these from the existing stderr logger:
```
I/w | wallet.Standard_Wallet.[test_segwit_3] | set_up_to_date: True
I/i | interface.[testnet.aranguren.org:51002] | set blockchain with height 2343721
D | util.profiler | ElectrumWindow.load_wallet 0.0778 sec
I | gui.qt.ElectrumGui | starting Qt main loop
```
With these re what I propose for the stderr logger:
```
  3.20 | D | util.profiler | Abstract_Wallet.get_full_history 0.0029 sec
  5.70 | I | i/interface.[testnet1.bauerj.eu:50002] | disconnecting due to: ConnectError(ConnectionRefusedError(22, 'The remote computer refused the network connection', None, 1225, None))
 38.63 | I | w/wallet.Standard_Wallet.[9dk] | starting taskgroup.
 38.84 | D | util.profiler | WalletDB._write 0.0059 sec
 62.96 | I | i/interface.[blockstream.info:993] | set blockchain with height 2343722
150.65 | I | exchange_rate.CoinGecko | getting fx quotes for EUR
```
2023-01-02 14:06:10 +00:00
SomberNight
8995a3e1bd Qt chan list: Ctrl+F filter to work for long channel id 2022-12-10 12:46:17 +00:00
SomberNight
52ccea5329 lnchannel: log chan id in ChannelBackup logger
otherwise it's hard to debug what's going on when having many channels
2022-12-10 12:45:53 +00:00
ThomasV
e8ac09721c kivy: remove user_rbf boolean property (unused) 2022-12-07 15:59:11 +01:00
ThomasV
3131fde97b submarine swaps: set rbf for CLI transactions
(it was already the case with GUI)
2022-12-07 13:26:29 +01:00
SomberNight
f86229f169 Merge pull request #8091 from zouppen/convert_currency_cmd
Add command for currency conversions
2022-12-06 18:29:49 +00:00
Joel Lehtonen OH64K
a24a928e9f commands: Make conversion to/from BTC the default
As suggested by SomberNight in PR #8091, the difference is that this
commit handles currencies in case-insensitive manner.

Co-authored-by: ghost43 <somber.night@protonmail.com>
2022-12-06 16:46:15 +02:00
Joel Lehtonen
62711a57bc commands: Better default currencies in convert_currency
Co-authored-by: ghost43 <somber.night@protonmail.com>
2022-12-06 04:19:48 +02:00
Joel Lehtonen
0b540956fb exchange_rate: "BTC" to "BTC" rate is not guaranteed to be present
Which ccy rates are available depends on the configured
exchange (config key use_exchange) and the configured currency (config
key currency). Only for some exchanges, the fx.ccy-BTC fx rate is
available (depends on the ExchangeBase.get_rates implementation).

As they say, for hodlers 1 BTC = 1 BTC.
2022-12-06 04:19:23 +02:00
Joel Lehtonen
09170bdd1f commands: Improve error messages in convert_currency
Co-authored-by: ghost43 <somber.night@protonmail.com>
2022-12-06 03:30:24 +02:00
Joel Lehtonen OH64K
cdc1660d47 commands: Remove unused requested_amount and fix a typo (#8090) 2022-12-05 22:31:16 +00:00
Joel Lehtonen
02dba54ab9 commands: Add command "convert_currency"
This adds command "convert_currency" which allows the user to do
currency conversions via command line or JSON RPC. Wallet not
required.
2022-12-05 23:29:37 +02:00
Joel Lehtonen
01d31dd61d exchange_rate: Add precisions of some cryptocurrencies
There are many cryptocurrencies available in CoinGecko and some other
exchange rate providers. If the user wants to use a cryptocurrency as
a display currency, the precisions used to be 2. This patch adds
precisions of some cryptocurrencies.
2022-12-05 23:08:12 +02:00
Joel Lehtonen
9ac58d0bc0 exchange_rate: Allow formatting amount with custom currency 2022-12-05 23:08:12 +02:00
Sander van Grieken
21d1842b84 log if get_history fails sanity check 2022-12-03 11:09:51 +01:00
Sander van Grieken
96f4530eb2 qml: ReceiveDialog styling 2022-12-05 19:42:29 +01:00
ghost43
e8c5ff5d2d Merge pull request #8087 from SomberNight/20221204_build_nproc_2
CI: AppImage build is failing with `Container errored with 'OOMKilled'`
2022-12-04 16:30:37 +00:00
SomberNight
feb75ec9e6 CI: AppImage build is failing with "Container errored with 'OOMKilled'"
"AppImage build" on the CI is failing with "Container errored with 'OOMKilled'" since 65ae281180
https://cirrus-ci.com/task/6506466559918080
https://cirrus-ci.com/task/6518283422662656

Apparently, when running in a Cirrus CI container, `nproc` returns the number of host CPUs,
instead of the number of cpus available to the container.
Opened upstream issue:
https://github.com/cirruslabs/cirrus-ci-docs/issues/1115
2022-12-04 00:11:29 +00:00
SomberNight
8cfbce827c ledger plugin: fix binaries
follow-up https://github.com/spesmilo/electrum/pull/8041
(ac239a81b8)
2022-12-03 22:52:23 +00:00