Commit Graph

19963 Commits

Author SHA1 Message Date
ghost43 ca212da72a Merge pull request #10605 from f321x/crash_reporter_start_new_window
qt: send start_new_window exc to reporter
2026-04-24 14:05:36 +00:00
SomberNight 5af40f435a Merge branch '202604_pr10603_ledger'
adapt Ledger_Client_Legacy to work with newer ledger bitcoin app

manual merge of https://github.com/spesmilo/electrum/pull/10603
2026-04-24 13:57:23 +00:00
f321x c8c44e354c qt: send start_new_window exc to reporter
Send more types of exceptions happening during daemon.load_wallet
in `ElectrumGui.start_new_window()` to the crash reporter to catch
e.g. assertion failures instead of showing them to the user as a warning
dialog.
2026-04-24 15:54:56 +02:00
SomberNight 1096ebcd6a build: update pinned ledger-bitcoin (partial rerun freeze_packages) 2026-04-24 13:51:07 +00:00
ghost43 b9dc6aa34c Merge pull request #10591 from SomberNight/202604_fix_wallet_mktx_base_tx
wallet: make_unsigned_tx: fix base_tx for GUI simple-send batching
2026-04-24 13:01:24 +00:00
ghost43 e96b833fe7 Merge pull request #10592 from SomberNight/202604_testnet_mainnet_mixup2
wallet_db: put 'genesis_blockhash' in DB, detect mainnet/testnet mixup. (db upgrade)
2026-04-24 12:59:31 +00:00
ghost43 c66458e517 Merge pull request #10598 from f321x/onion_message_followup
onion_messages: minor simplifications, followup 10546
2026-04-24 12:58:24 +00:00
f321x 5a0c052384 onion_message: move round-robin logic in Request method 2026-04-24 14:00:16 +02:00
f321x 3ff3205b19 onion_message: use util.random_shuffled_copy instead rand sort 2026-04-24 14:00:16 +02:00
f321x d31d1cf75e onion_message: simplify send_onion_message_to
Remove the hops data encryption from the blinded path branch of
send_onion_message_to. Our hops data is already encrypted before
and the blinded paths hops data is already encrypted by the recipient,
so this is a no-op.

Also use encrypt_hops_recipient_data in create_route_to_introduction_point,
it does the same as the existing encryption step.
2026-04-24 14:00:16 +02:00
Ilya Artemov 44570bfa3b Bump minimum required version of ledger_bitcoin (build-time and runtime) 2026-04-24 09:09:00 +02:00
ghost43 294fdd1267 Merge pull request #10604 from f321x/dedup_valid_wallet_name
qml: deduplicate wallet name validation
2026-04-23 14:30:13 +00:00
f321x d34129ef5c qml: deduplicate wallet name validation
Deduplicates the wallet name validation between wizard and daemon.
2026-04-23 16:11:36 +02:00
ThomasV 7c433c5645 rm 'received orphan channnel' log line (too verbose) 2026-04-23 09:29:08 +02:00
ThomasV 4b412de93c Merge pull request #10599 from f321x/fix_fw_fail_htlc
regtest: make fw_fail_htlc less flaky
2026-04-23 09:07:38 +02:00
ghost43 d13c6a6a92 Merge pull request #10596 from romanz/update-patch
appimage: update Dockerfile dependencies
2026-04-22 17:54:03 +00:00
ghost43 230e627559 Merge pull request #10600 from SomberNight/202604_lnpeer_chan_reest
lnpeer: channel_reestablish: split "they_are_ahead" into ctn vs revnum
2026-04-22 16:27:10 +00:00
f321x 14f202941e regtest: increase timeouts 30s -> 120s
I suspect the timeouts are a bit too short for the slow ci machine.
2026-04-22 18:00:52 +02:00
SomberNight 46eadbf442 lnpeer: channel_reestablish: further restrict states for msg handler
re REQUESTED_FCLOSE and WE_ARE_TOXIC (as per f321x):
> There is no reason for the peer to send channel_reestablish after we
> have sent the force close request (error) and I assume we don't
> want to give surface to the peer to attempt finding out if we really lost state?

re FORCE_CLOSING:
the peer might not have realised we started force-closing but we probably don't want to run the message-handler even in that case
2026-04-22 15:57:18 +00:00
f321x 36e9f185d2 regtest: make fw_fail_htlc less flaky
On master fw_fail_htlc is, especially on the CI, flaky.
We mine 100 blocks, then wait fixed 5 seconds, then check if bob has
failed back the htlcs to alice.
However if the test runs slowly (CI) 5 seconds can be too short
for bob to catch up to the new 100 mined blocks.
Instead we should just use the wait_until_htlcs_settled helper function
which polls Alice local_unsettled_sent with 30 sec timeout, allowing bob
to take a bit longer (or be faster) than 5 s.

```
.***** test_fw_fail_htlc ******
initializing alice
funding alice
a101c8c4c22043ff42029bcab2f0bf6ce5482a60d656294cbec3a4df557e2687
initializing bob
funding bob
d323d572c54817116d185c91f15e449550c651eb4ed76891d3011e0a8eb4ef9a
initializing carol
funding carol
bbf3503663876a4ae00f70c7e58ad49318e83d5cf99d6effe692e113d10910c2
mining 1 blocks
starting daemon (PID 5559)
/tmp/alice/regtest/wallets/default_wallet
true
starting daemon (PID 5577)
/tmp/bob/regtest/wallets/default_wallet
true
starting daemon (PID 5595)
/tmp/carol/regtest/wallets/default_wallet
true
alice and carol open channels with bob
mining 3 blocks
wait until alice sees channel open.
wait until alice sees channel open..
wait until alice sees channel open...
alice pays carol
Daemon stopped
mining 1 blocks
mining 150 blocks
wait until 99ad1d44b9054f5a85c2fb45e9a9b93eb13c785104ed0664be5cf866d79d38fc:2 is spent.
...
wait until 99ad1d44b9054f5a85c2fb45e9a9b93eb13c785104ed0664be5cf866d79d38fc:2 is spent............................
mining 1 blocks
mining 100 blocks
alice htlc was not failed
FDaemon stopped
```
2026-04-22 17:12:30 +02:00
Roman Zeyde 8e49eb8087 appimage: update Dockerfile dependencies 2026-04-22 12:08:32 +02:00
ThomasV bca41d941d Merge pull request #10573 from f321x/qml_wallet_rename
qml: allow renaming wallets
2026-04-22 10:03:14 +02:00
ThomasV 294d21407a Merge pull request #10568 from SomberNight/202604_verifier_left_sibling_duplicates
verifier.py: fix CVE-2012-2459: reject left-sibling duplicates
2026-04-21 16:22:07 +02:00
ThomasV c189360120 Merge pull request #10590 from SomberNight/202604_test_lnpeer_flaky_hold_invoice_set
tests: lnpeer: fix flaky test "hold_invoice_set_doesnt_get_expired"
2026-04-21 13:30:21 +02:00
Felix 1bea23926f Merge pull request #10595 from f321x/update_ci_review_model
ci: bump code review ci claude version 4.6 -> 4.7
2026-04-21 13:27:30 +02:00
f321x 1ba31448a3 ci: bump code review ci claude version 4.6 -> 4.7
An improved Claude Opus version got released, this bumps the code review
CI to use it.
2026-04-21 13:24:02 +02:00
ghost43 b45d89e120 Merge pull request #10546 from f321x/bolt12_preparation_1
bolt12: preparation 1
2026-04-20 15:09:41 +00:00
SomberNight 68e6995a3c bitcoin.py: add helper func: neuter_bitcoin_address 2026-04-20 13:27:21 +00:00
SomberNight 45458c2f89 wallet_db: put 'genesis_blockhash' in DB, detect mainnet/testnet mixup
If the user tries to open a wallet for a different chain (mainnet vs testnet), try to show a reasonable error message.

See previous attempt at this: https://github.com/spesmilo/electrum/commit/c13e05770150c5210783c3d42d3d2b1a683f18b4, which added `wallet.test_addresses_sanity()`. However there are many codepaths where "random" exceptions might get raised before the Wallet object is even instantiated.
See [discussion there](https://github.com/spesmilo/electrum/commit/c13e05770150c5210783c3d42d3d2b1a683f18b4#commitcomment-28017341):
> should we actually fix that?
> if yes, it would be better to write the network type in storage

Indeed now I think we should do that. At the time I was concerned it would not help against altcoin forks if we put "mainnet" or "testnet" in the DB. Now I realise we should just put the genesis block hash in the DB instead.

Many of the reports in https://github.com/spesmilo/electrum/issues/6526 are likely due to users trying to open a mainnet wallet in testnet mode or vice-versa.

fixes https://github.com/spesmilo/electrum/issues/9134
    same issue in wizard 2fa two-step wallet-creation flow
2026-04-20 01:39:35 +00:00
SomberNight febe95e642 wallet: make_unsigned_tx: fix base_tx for GUI simple-send batching
fixes regression from https://github.com/spesmilo/electrum/commit/a9f20e4d3de9848247a9079b5b164d8006cf80db :
For the GUI / manual new tx constructions usecase, the flow relies on `base_tx.add_info_from_wallet(self)` being called before `base_tx_fee = base_tx.get_fee()`.

fixes https://github.com/spesmilo/electrum/issues/10587
maybe fixes https://github.com/spesmilo/electrum/issues/8876
    probably not a full fix: base_tx could have inputs for which add_info_from_wallet is not sufficient
2026-04-19 22:22:39 +00:00
SomberNight ca8bdba0c5 tests: lnpeer: fix flaky test "hold_invoice_set_doesnt_get_expired"
This test was flaky: the mpp_set resolution gets set to SETTLING several asyncio event loop iterations before the hold invoice callback "cb" gets called.
If the 0.1 sec polling triggers just in the middle of that interval, `assert cb_got_called` fails.

```
    async def check_mpp_state():
        async def wait_for_resolution():
            while True:
                await asyncio.sleep(0.1)
                if payment_key not in bob_w.received_mpp_htlcs:
                    continue
                if not bob_w.received_mpp_htlcs[payment_key].resolution == RecvMPPResolution.SETTLING:
                    continue
                return
        await util.wait_for2(wait_for_resolution(), timeout=2)
>       assert cb_got_called
E       assert False

tests/test_lnpeer.py:1898: AssertionError
```

see https://github.com/spesmilo/electrum/blob/16c8cb50e38c274cce8f9f66f28d8dd453f9f074/electrum/lnpeer.py#L3136-L3137

fixes https://github.com/spesmilo/electrum/issues/10589

-----

diff to reproduce the failure without present patch:
```
diff --git a/tests/test_lnpeer.py b/tests/test_lnpeer.py
index 8669931c24..e15973d68f 100644
--- a/tests/test_lnpeer.py
+++ b/tests/test_lnpeer.py
@@ -1885,6 +1885,7 @@ class TestPeerDirect(TestPeer):
             cb_got_called = False
             async def cb(_payment_hash):
                 self.logger.debug(f"hold invoice callback called. {bob_w.network.get_local_height()=}")
+                await asyncio.sleep(1)
                 nonlocal cb_got_called
                 cb_got_called = True
```
2026-04-19 15:23:33 +00:00
SomberNight 21946e1e87 lnpeer: channel_reestablish: split "they_are_ahead" into ctn vs revnum 2026-04-18 17:23:35 +00:00
SomberNight 16c8cb50e3 lnchannel: (trivial) fix type hint of receive_fail_reasons 2026-04-18 17:16:57 +00:00
Ilya Artemov b3808b7920 Using GET_MASTER_FINGERPRINT for Legacy Client to get the root public key fingerprint 2026-04-16 15:02:07 +02:00
accumulator 3fbf597485 Merge pull request #10579 from f321x/qml_relay_list_padding
qml: add top padding to nostr relay url list
2026-04-14 18:18:05 +02:00
SomberNight 4a14feffd4 lnpeer: chan_reest: clarify my_current_per_commitment_point is ignored
`my_current_per_commitment_point` was only used prior to option_static_remotekey
2026-04-14 14:18:14 +00:00
f321x 24d93420fb qml: add top padding to nostr relay url list
The first relay url was close to the top of the ElTextArea and looked a
bit sliced. Adding some padding makes it look better.
2026-04-14 08:34:18 +02:00
SomberNight 016c8b5f4c bip21: add comment listing URI scheme handler registrations
It is sufficiently rare that we have to touch this stuff that I always have to re-discover where/how it is done. And it is impractical to grep for "bitcoin:" or "lightning:".

Putting this "master list" comment very close to the BITCOIN_BIP21_URI_SCHEME variable seems like a good spot - at least this is where I would look for it first.
2026-04-11 02:55:54 +00:00
ghost43 1235b4a6b9 Merge pull request #10572 from f321x/fix_coingecko
exchange rate: fix coingecko api
2026-04-08 09:46:42 +00:00
f321x 8a12874c8e qml: allow renaming wallets
Allows to rename a wallet file from the QML Wallet Details view.
This seems like a feature we should support as the use-case of a wallet can
change or maybe the user didn't think about a proper name when setting
up the wallet. Especially with lightning channels it is not possible to
restore from seed to change the name.

Fixes #4377
2026-04-08 10:45:59 +02:00
f321x 9827734ab6 exchange rate: fix coingecko api
The CoinGecko API failed as the Honduran Lempira currency returned
null as value, rendering the API unusable:
```
11.19 | I | exchange_rate.CoinGecko | getting fx quotes for EUR
11.41 | E | exchange_rate.CoinGecko | failed fx quotes: InvalidOperation([<class 'decimal.ConversionSyntax'>])
Traceback (most recent call last):
  File "/var/home/user/code/vibecoding_vm/electrum/electrum/exchange_rate.py", line 87, in update_safe
    self._quotes = await self.get_rates(ccy)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/user/code/vibecoding_vm/electrum/electrum/exchange_rate.py", line 449, in get_rates
    return dict([(ccy.upper(), to_decimal(d['value']))
                               ~~~~~~~~~~^^^^^^^^^^^^
  File "/var/home/user/code/vibecoding_vm/electrum/electrum/util.py", line 243, in to_decimal
    return Decimal(str(x))
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
```

```
"hnl":{"name":"Honduran Lempira","unit":"L","value":null,"type":"fiat"}
```
2026-04-08 10:20:01 +02:00
ThomasV 3304d76920 Merge pull request #10571 from f321x/nwc_handle_null_params
plugin: nwc: handle 'params: null' in request
2026-04-07 13:37:53 +02:00
f321x fd230cf9d1 plugin: nwc: handle 'null' params in request
Some clients send 'params: null' instead of 'params: {}' or no
params key at all.
2026-04-07 09:52:13 +02:00
SomberNight 3d39074294 verifier.py: fix CVE-2012-2459: reject left-sibling duplicates
Due to how the txid-commitment merkle tree used in the block headers is constructed, we need an extra check to be able to validate the *position* of a txid in a block.

I think this is low severity for us.

See https://bitcointalk.org/?topic=102395 :

> The Merkle hash implementation that Bitcoin uses to calculate the Merkle
> root in a block header is flawed in that one can easily construct multiple
> lists of hashes that map to the same Merkle root.
> For example, merkle_hash([a, b, c]) and merkle_hash([a, b, c, c]) yield
> the same result. This is because, at every iteration, the Merkle hash
> function pads its intermediate list of hashes with the last hash if the
> list is of odd length, in order to make it of even length.
>
> And so, the Merkle root function can be effectively preimaged by
> changing the input so that one of the intermediate lists is of even
> length with the last two elements equal (where originally it was
> of odd length with a last element equal to the earlier mentioned two).
> As was later noted, this extends to any input length that is
> not a power of two:
> merkle_hash([a, b, c, d, e, f]) == merkle_hash([a, b, c, d, e, f, e, f]).
> Note that to maintain the same root hash, the only flexibility that
> exists is duplication of elements.

Ported from https://github.com/Electron-Cash/Electron-Cash/commit/165146362b4cb0ad74770b36aca1f9acb2800195

Co-authored-by: bitcoincashautist <80100588+A60AB5450353F40E@users.noreply.github.com>
2026-04-03 02:22:01 +00:00
ThomasV 7a6a39d1aa add comments about xpub encryption 2026-04-02 14:46:50 +02:00
ghost43 2ea4874600 Merge pull request #10566 from f321x/release_script_apk
contrib: check for unsigned apk in release.sh
2026-04-02 12:44:31 +00:00
f321x 7adc833f21 contrib: check for unsigned apk in release.sh
release.sh expects signed apks. if a non-releasemanager uses
release.sh to build it will build the apks unsigned and then
rename them to the same name as the signed apks. However
if the apks have already been built separately and are still named
*-unsigned.apk it will not detect them and instead try to build them
again. Instead it should just rename them to *-release.apk as if built
directly through release.sh.
2026-04-02 13:49:32 +02:00
SomberNight e71616e673 update release notes for version 4.7.2 2026-04-01 15:50:28 +00:00
f321x 4254c9a051 onion_message: fix route construction to ip
Don't include first hop of the path,
this is the hop from us to the first node and we don't
need a payload for ourselves.

Also adds unittest checking this.
2026-04-01 09:07:36 +02:00
f321x 4134dc7b25 onion_message: split send_onion_message_to
Factor out code from `send_onion_message_to` into a separate
function `_create_route_to_introduction_point` to make it
easier to reason about it and more testable.
2026-04-01 09:07:36 +02:00