1
0
Commit Graph

19633 Commits

Author SHA1 Message Date
SomberNight
a27e2cc6b5 addr_sync: update "stored_height" db field immediately on wallet-open
Repro steps:
- in qt gui, with network enabled, open wallet1
- open wizard, create wallet2 (restore from seed something that has mined history)
- close both wallets, stop electrum
- start electrum with "-o" offline flag, open wallet2
- observe all txs in history tab show up as "unconfirmed"

The cause is that "stored_height" only gets updated ~on new blocks.
So if you created a wallet and closed it soon, its db would not contain "stored_height."
2026-01-15 16:43:22 +00:00
ghost43
9857534e18 Merge pull request #10413 from SomberNight/202601_mpp_status_htlcs_frozenset
lnutil: change ReceivedMPPStatus.htlcs to frozenset, i.e. immutable
2026-01-15 16:40:26 +00:00
SomberNight
c37b844f66 lnutil: change ReceivedMPPStatus.htlcs to frozenset, i.e. immutable
As ThomasV says:

> ReceivedMPPStatus is a Namedtuple, which is immutable, but it contains
> a mutable field. Since ReceivedMPPStatus is not a StoredObject,
> no patch will be created when the htlcs list is modified, and we may
> end up not saving the change to disk if partial writes are enabled.

patch taken from https://github.com/spesmilo/electrum/pull/10395#pullrequestreview-3634244541
closes https://github.com/spesmilo/electrum/pull/10395

Co-authored-by: f321x <f@f321x.com>
2026-01-15 15:59:14 +00:00
ghost43
5266b3d61e Merge pull request #10371 from accumulator/qml_manual_fee_feerate_edit
qml: allow manual editing of fee/feerate
2026-01-15 14:43:08 +00:00
SomberNight
8a3d9fd758 qml: FeePicker: restrict abs/rate editing to mimic wallet.bump_fee/cpfp 2026-01-14 16:53:30 +00:00
SomberNight
ca597942fd qml: (trivial) qeinvoice: add type hint 2026-01-14 16:13:00 +00:00
ghost43
5db4a16ace Merge pull request #10410 from f321x/fix_10406
qml: fix invalid QEInvoiceParser state
2026-01-14 15:55:18 +00:00
f321x
b599ae7d4a qml: fix invalid QEInvoiceParser state
Fixes the issue described in #10406.
When scanning a lightning invoice we would pass it to
`QEInvoiceParser.fromResolvedPaymentIdentifier()`, however
`fromResolvedPaymentIdentifier()` doesn't reset the state of
`QEInvoiceParser._lnurlData` which is used in QML to evaluate
`payImmediately: invoiceParser.isLnurlPay` in the `onValidationSuccess`
connection.

This change calls `clear()` in `fromResolvedPaymentIdentifier()` to
ensure that `QEInvoiceParser` state gets reset when loading a new invoice.
However when retrieving a bolt11 from a lnurl-pay callback we don't
wan't to reset `QEInvoiceParser._lnurlData` so that `payImmediately` is
true when confirming the lnurl pay dialog, for that I skip calling
`fromResolvedPaymentIdentifier()` and instead call `validateRecipient()`
directly so the `QEInvoiceParser` state doesn't get reset in this case.
2026-01-14 11:42:55 +01:00
ThomasV
fa575ab1fc fix test_onion_message (follow-up previous commit) 2026-01-13 17:36:06 +01:00
ThomasV
1845143786 lnpeer: wait_for_received_pending_htlcs_to_get_removed: wait only if peer has been initialized 2026-01-13 17:16:10 +01:00
ThomasV
69af2f77ed Merge pull request #10404 from f321x/fix_10403
ExchangeRate: return NaN if rate is 0
2026-01-13 14:55:20 +01:00
f321x
5199c6c742 ExchangeRate: return NaN if rate is 0
Prevent DivisionByZero exceptions by returning `Decimal('NaN')
instead of `Decimal(0)` if the exchange rate is 0.

Fixes https://github.com/spesmilo/electrum/issues/10403

```
>>> bool(Decimal(0))
False
```
2026-01-13 13:57:14 +01:00
ThomasV
0c29c5006e Merge pull request #10394 from f321x/cosigner_wallet_event_listener
bugfixes: set psbt_nostr event on aio loop and use correct cb in TxEditor
2026-01-13 13:45:06 +01:00
SomberNight
65f245f475 qml: FeePicker: hide "Target" line in "Manual" mode
instead use font colors to hint which textedit is being used for target
2026-01-12 18:42:14 +00:00
SomberNight
f387300ab2 qml: FeePicker: use UI_UNIT_NAME constants, instead of hardcoding 2026-01-12 18:41:52 +00:00
ghost43
5778fa401d Merge pull request #10363 from f321x/unittest_lnwallet
tests: add test_lnwallet to test lnwallet utils
2026-01-12 15:20:52 +00:00
ghost43
331ed0fe02 Merge pull request #10400 from f321x/fix_qml_type_error
qml: add close no-op to QEQRScanner to fix type error
2026-01-11 06:06:02 +00:00
ghost43
45e1b0da8d Merge pull request #10402 from f321x/fix_test_reestablish_with_old_state
test_lnpeer: use PeerInTests instead if Peer
2026-01-11 03:02:38 +00:00
ThomasV
dac507ec3c Merge pull request #10396 from f321x/fix_qml_balance
AddressSynchronizer: invalidate balance cache on spv
2026-01-09 10:45:58 +01:00
f321x
dee2371738 test_lnpeer: use PeerInTests instead if Peer
ec65c53 replaces the usage of `PeerInTest` with `Peer` in
test_lnpeer.py.
PeerInTests sets `Peer.DELAY_INC_MSG_PROCESSING_SLEEP` to 0 so all
incoming messages get processed immediately. Because `Peer` instead of
`TestInPeer` was used the delay caused `test_reestablish_with_old_state`
to fail regularly because bob receives the old channel state and kills
the OldTaskGroup of the unittest with GracefulDisconnect before Alice
processed the answer of Bob and is still in ChannelState.REESTABLISHING.

```
FAILED tests/test_lnpeer.py::TestPeerDirect::test_reestablish_with_old_state - AssertionError: <PeerState.REESTABLISHING: 1> != <PeerState.BAD: 3>
```
2026-01-08 14:57:13 +01:00
f321x
562839c540 tests: add TestLNWallet to test lnwallet utils
Adds new unittest file test_lnwallet.py to allow unittesting
utility functions of LNWallet.
2026-01-08 13:16:34 +01:00
f321x
04b7b683ed qml: add close no-op to QEQRScanner to fix type error
Adds close() no-op method to QEQRScanner to prevent type errors like
this:
```
01-02 17:28:09.645 10543 10565 I python  : 162.27 | W | gui.qml.qeapp | file:///data/data/org.electrum.electrum/files/app/electrum/gui/qml/components/SweepDialog.qml:123: TypeError: Property 'close' of object QEQRScanner(0xdd32f66fb600)
is not a function
```
2026-01-08 11:14:06 +01:00
f321x
663fcddc0c AddressSynchronizer: invalidate balance cache on spv
There was a race incorrectly counting transactions with one
confirmations to the unconfirmed balance instead of the confirmed
balance.
This happened because the balance cache of AddressSynchronizer got
invalidated after `on_event_blockchain_updated` and then again after
`receive_history_callback`->`add_transaction`, however when calling
`AddressSynchronizer.get_balance()` before the tx got spv verified the
height would still be counted as 0 (unconfirmed), populating the balance
cache again with the unconfirmed balance.
I noticed this only on QML due to timing differences to Qt.
Invalidating the cache in `AddressSynchronizer.add_verified_tx()` after
the tx got verified causes the balance to get recalculated and shown
correctly.
2026-01-07 18:15:08 +01:00
f321x
72f083d2d0 AddressSynchronizer: remove unneccessary loop
This loop seems like a leftover that is not useful anymore, clearing the
cache once has the same effect.
2026-01-07 16:36:07 +01:00
SomberNight
2172dadf62 hw plugins: coldcard: fix compat with ckcc-protocol v1.5.0
fixes https://github.com/spesmilo/electrum/issues/10386
2026-01-05 16:28:23 +00:00
SomberNight
f1f4fc0939 hw plugins: coldcard: log error when I forget to set udev rules
so that next time I check that before changing cables, usb hubs, and VMs o.O
2026-01-05 16:06:24 +00:00
ghost43
3bd5f1a681 Merge pull request #10372 from SomberNight/202512_lnworker_split
lnworker: split LNWallet and LNWorker: LNWallet "has an" LNWorker
2026-01-05 15:58:30 +00:00
SomberNight
927724145a tests: rm some more dead code 2026-01-05 15:56:13 +00:00
SomberNight
0afd433c42 tests: properly clean-up MockLNWallets after tests finish 2026-01-05 15:56:10 +00:00
SomberNight
c3e373a3b2 lnchannel: chan.lnworker must now always be set, even in unit tests 2026-01-05 15:56:07 +00:00
SomberNight
dfeb9918d8 tests: lnchannel: rewrite create_test_channels to use LNWallet 2026-01-05 15:56:04 +00:00
SomberNight
17f41044d5 tests: lnpeer: fix cyclic lnworker.wallet.lnworker inconsistency
These better hold, lol:
wallet.lnworker.wallet == wallet
lnworker.wallet.lnworker == lnworker
2026-01-05 15:56:01 +00:00
SomberNight
ea42b02ceb tests: simplify MockLNWallet, add fixme for cyclic inconsistency 2026-01-05 15:55:58 +00:00
SomberNight
91b98240dc tests: lnpeer: follow-up prev: rm horrible ugly hack 2026-01-05 15:55:54 +00:00
SomberNight
ec65c53de3 tests: lnpeer: mostly unify prepare_peers and prepare_graph 2026-01-05 15:55:51 +00:00
SomberNight
024f9b988d tests: lnpeer: (move-only) towards unifying prepare_{peers,graph} 2026-01-05 15:55:48 +00:00
SomberNight
17b7974800 tests: lnpeer: simplify tx_queue 2026-01-05 15:55:45 +00:00
SomberNight
b292c027c3 lnpeer: move make_local_config to LNWallet
no functional changes
2026-01-05 15:55:41 +00:00
SomberNight
1006e8092f lnworker: split LNWallet and LNWorker: LNWallet "has an" LNWorker
- LNWallet no longer "is-an" LNWorker, instead LNWallet "has-an" LNWorker
- the motivation is to make the unit tests nicer, and allow writing unit tests for more things
  - I hope this makes it possible to e.g. test lnsweep in the unit tests
  - some stuff we would previously have to write a regtest for, maybe we can write a unit test for, now
- in unit tests, MockLNWallet now
  - inherits LNWallet
  - the Wallet is no longer being mocked
2026-01-05 15:55:31 +00:00
f321x
31ac44dddd TxEditor: register correct callback
on_event_channels_updated doesn't get fired if channels change their
state to OPEN. TxEditor needs to use on_event_channel to notice channels
coming online.
2026-01-05 16:36:10 +01:00
f321x
e033a5e67b psbt_nostr: add EventListener comment to CosignerWallet
I got confused how on_event_proxy_set can even work if CosignerWallet
doesn't inherit from EventListener until i figured out its children use
the EventListener too. To avoid this confusion i added two comments.
2026-01-05 16:36:05 +01:00
f321x
0d380218a6 bug: psbt_nostr: set CosignerWallet.pending on aio loop
Fixes:
```
Traceback (most recent call last):
  File "/home/user/code/electrum-fork/electrum/plugins/psbt_nostr/qt.py", line 149, in on_receive
    self.mark_pending_event_rcvd(event_id)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/user/code/electrum-fork/electrum/plugins/psbt_nostr/psbt_nostr.py", line 254, in mark_pending_event_rcvd
    self.pending.set()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.14/asyncio/locks.py", line 192, in set
    fut.set_result(True)
    ~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib64/python3.14/asyncio/base_events.py", line 829, in call_soon
    self._check_thread()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.14/asyncio/base_events.py", line 866, in _check_thread
    raise RuntimeError(
        "Non-thread-safe operation invoked on an event loop other "
        "than the current one")
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
```
2026-01-05 16:02:14 +01:00
ghost43
bdcd3f9c7c Merge pull request #10364 from f321x/test_dont_settle_htlcs_forwarding
lnpeer/lnworker: check dont_settle_htlcs when forwarding
2025-12-30 16:13:16 +00:00
ghost43
9d94a8b66d Merge pull request #10388 from SomberNight/202512_android_py311
android build: bump python version (3.10.18->3.11.14)
2025-12-30 15:54:15 +00:00
SomberNight
adb4f6f246 android build: bump python version (3.10.18->3.11.14)
Bump the python version used on Android from 3.10 to 3.11.
The substance is the backport of the corresponding commit [0] from upstream p4a.

Tested that apk is still reproducible by doing two full builds.
I also used the apk a bit and it seems to work at runtime. :)

[0]: 78db83223f  (which got squashed into 83e74cac0f)
2025-12-27 03:31:19 +00:00
ghost43
ca410beae1 Merge pull request #10385 from f321x/bump_zxingcpp
android: bump barcodescannerview, allow tap to focus, rm 16kb patch
2025-12-22 18:27:44 +00:00
ghost43
a50f963a61 Merge pull request #10373 from accumulator/qml_helpdialog_styling
qml: improve HelpDialog styling
2025-12-22 17:29:57 +00:00
ghost43
261561ad0b Merge pull request #10384 from f321x/pi_handling_lightning_prefix
pi: fix incorrectly parsing emaillike with 'ln' prefix as bech32 ln pi
2025-12-22 17:13:12 +00:00
f321x
dd1d98e37c pi: allow emaillike pi with 'lightning:' prefix
Lightning addresses with 'lightning:' do occur in the wild and make
sense (how else would e.g. the smartphone know to open a lightning
wallet instead of the e-mail client). So we should allow this.
2025-12-22 18:06:26 +01:00
f321x
2cd1de4f21 pi: fix incorrectly parsing emaillike with 'ln' prefix
Fixes a bug where we incorrectly parsed emaillike payment identifiers as
bech32 lightning payment identifier if they start with a 'ln' prefix.
2025-12-22 18:06:17 +01:00