Commit Graph

19813 Commits

Author SHA1 Message Date
ThomasV e309f89a27 test_lnpeer: factorize test_reestablish_replay_messages 2026-03-06 09:28:05 +01:00
ghost43 851781fba5 Merge pull request #10508 from SomberNight/202603_lnpeer_test_mpp_cleanup_more_robust
tests: lnpeer: make mpp_cleanup_after_expiry more robust
2026-03-04 18:49:37 +00:00
SomberNight db003257ff tests: lnpeer: make mpp_cleanup_after_expiry more robust
As there are two htlcs, the `alice_htlc_resolved` Event might get set either once or twice by the time `alice_htlc_resolved.wait()` returns. The previous code was assuming that both htlcs are resolved by then, but it could happen that only one htlc was resolved, due to timing.
2026-03-04 18:12:53 +00:00
ghost43 fd52b97046 Merge pull request #10505 from f321x/nwc_improvement
plugins: nwc: sync with spec, fix some bugs
2026-03-03 17:56:14 +00:00
ghost43 cb696ed6f8 Merge pull request #10504 from accumulator/move_qt_event_listener
common_qt: move QtEventListener and qt_event_listener decorator to common_qt
2026-03-03 17:48:01 +00:00
ghost43 0cb4e89aee Merge pull request #10503 from accumulator/qt_coins_fully_spend_menu
qt: utxo_list: only enable 'fully spend...' menu if there are unfrozen coins in the selection.
2026-03-03 17:37:58 +00:00
SomberNight 4c27b8de8d qt: utxo_list: add asserts to helper methods that coins are selected
- otherwise they default to selecting all coins, which is unlikely to be what the user intends
- prev commit makes sure this should never happen
2026-03-03 17:29:22 +00:00
f321x 835ab39d77 plugin: nwc: bump version to 0.0.2
these changes deserve a new version
2026-03-03 18:04:54 +01:00
f321x ea1e2c8240 plugin: nwc: add 'state' field to responses
NIP-47 got extended to include an optional 'state' field in responses.
Implementing this acutally fixes an issue of Alby Go showing succeeded
payments as failed that appeared recently.
2026-03-03 18:04:52 +01:00
f321x 5222374046 plugin: nwc: improved budget accounting
Increase the payment budget before attempting the payment
and decrease again if the payment fails. This prevents a race
where multiple concurrent payments could pass the budget check
before the budget is incremented through any of the other payments.

A lock around the budget is not suitable either as then one long
stuck payment (hold invoice) would render the budget inaccessible for
all other payment attempts.
2026-03-03 18:04:51 +01:00
f321x 3956bff068 plugin: nwc: do budget accounting in msat
Keep track of the spent amount in msat instead of sat to prevent
issues due to rounding.
The budget is still specified in sat.
2026-03-03 18:04:47 +01:00
ghost43 cbaa3a8ba6 Merge pull request #10467 from f321x/fix_10464
qt: MyTreeView: close menu if its context changes
2026-03-03 16:53:45 +00:00
f321x 423cc678c8 qt: MyTreeView: close menu if its context changes
Stores the currently open (right-click) menu in MyTreeView
and adds a `close_menu()` method so inheritants can cleanly
close the menu again if the context it was opened upon has changed.

This is utilized by `AddressList` and `UTXOList` to close the menu
if a call to `update()` has chenged the address list in some way or
removed a utxo from the list to prevent the user from trying to use
a utxo that doesn't exist anymore.

Fixes #10464
2026-03-03 17:28:57 +01:00
Sander van Grieken 91efb3e1f4 common_qt: move QtEventListener and qt_event_listener decorator to common_qt 2026-03-03 13:03:46 +01:00
f321x 0dc08fdf24 plugin: nwc: handle encryption scheme signaling
NIP-47 now defines how client/server should communicate their supported
encryption schemes. For backwards compatibility its not strictly
neccessary to implement this but it seems cleaner to explicitly handle
it.
2026-03-03 11:27:09 +01:00
f321x 4c703ea278 plugin: nwc: remove multi_pay_invoice rpc
It got removed from the spec so we don't need to support it anymore.
https://github.com/nostr-protocol/nips/pull/2210
2026-03-03 11:22:07 +01:00
ThomasV 161142ddb0 Merge pull request #10502 from SomberNight/202603_lnworker_payment_infos_convert_amount
wallet_db: convert PaymentInfo amounts from 0 to None
2026-03-03 09:27:40 +01:00
SomberNight fe5cb09e05 wallet_db: convert PaymentInfo amounts from 0 to None
When creating a "zero-amount" payment request, currently we save a PaymentInfo with a "None" amount.
I think there were a few releases in 2023 that saved PaymentInfos with a `0` amount instead. This was changed in #8659 [0], but as said there [1], a DB upgrade was not done.
Now an assert added in [2] is failing due to this inconsistency, for affected old wallets.
- I think to trigger that, one needs a wallet that has a payment request (with a `0` amount) created around that time, which is still unpaid.

This patch tries to restore consistency by enforcing None amounts.

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

[0]: https://github.com/spesmilo/electrum/pull/8659
[1]: https://github.com/spesmilo/electrum/pull/8659#issuecomment-1777101285
[2]: https://github.com/spesmilo/electrum/commit/286fc4b86e4d23cb9af15b9061b3d709e7592bcb
2026-03-02 17:12:07 +00:00
Sander van Grieken f3ba25df7d qt: utxo_list: only enable 'fully spend...' menu if there are unfrozen coins in the selection.
otherwise, when selecting only frozen coins, the set of usable coins is empty, and the menu options
will instead fall back to using ALL coins without informing the user.
2026-03-02 18:04:08 +01:00
ghost43 ff44d4b4d1 Merge pull request #10093 from f321x/anchor_output_sweeping_lower_fee
txbatcher: don't spend anchors if ctx fee is already sufficient
2026-02-28 03:52:25 +00:00
f321x 04a034e6ba tests: add unittest for TxBatch._to_sweep_after()
Adds unittest for `TxBatch._to_sweep_after()` anchor claiming part.
2026-02-27 17:18:01 +01:00
f321x c4dcd85afc txbatcher: don't spend anchors if ctx fee is sufficient
If the tx fee of the ctx is already higher than the required target it
is not useful to spend the anchor with a lower fee (the current target),
so instead it is skipped.
2026-02-27 17:17:53 +01:00
SomberNight a36c9a24db build: appimage: fix build missing a system-wide python
```
�� INFO:  preparing electrum-locale.
[...]
running stats.py
/usr/bin/env: �python3�: No such file or directory
```

regression from https://github.com/spesmilo/electrum/commit/3afa2fcdf3cce609d8813bbdd7b5962214de5ec0

This had shown up on the CI [0] but we did not notice - there is too many random failures, too much noise :(

[0]: https://github.com/spesmilo/electrum/runs/64623983097
2026-02-26 19:34:08 +00:00
SomberNight d72b741173 update block header checkpoints 2026-02-26 17:49:31 +00:00
SomberNight 57bf8c89ec follow-up RELEASE-NOTES 2026-02-26 17:38:12 +00:00
ghost43 67b4ebd82c Merge pull request #10497 from f321x/version_4_7_1
Version 4.7.1 preparation
2026-02-26 17:35:15 +00:00
f321x eee2e85826 bump version to 4.7.1 2026-02-26 18:06:31 +01:00
f321x 8d95135af6 add version 4.7.1 release notes
Co-authored-by: SomberNight <somber.night@protonmail.com>
2026-02-26 18:05:31 +01:00
ghost43 ff6f37389e Merge pull request #10495 from SomberNight/202602_bump_secp
deps: bump libsecp256k1 version (0.7.0->0.7.1) and electrum-ecc
2026-02-26 15:28:19 +00:00
SomberNight d733350ac5 lnwatcher: ~document behaviour re subbing to historical chans and swaps
not so intuitive

ref https://github.com/spesmilo/electrum/pull/7852 ("Persist lnwatcher")
2026-02-25 18:48:04 +00:00
ghost43 2c9f4fdbae Merge pull request #10433 from f321x/qt_changelog
qt: add Changelog to Help menu in toolbar
2026-02-25 17:26:06 +00:00
SomberNight 9dc725fa56 deps: bump libsecp256k1 version (0.7.0->0.7.1) and electrum-ecc 2026-02-25 16:38:11 +00:00
ghost43 9a41a5472a Merge pull request #10442 from SomberNight/202601_lnworker_is_preimage_public
lnsweep: simplify maybe_reveal_preimage_for_htlc
2026-02-25 15:35:20 +00:00
SomberNight 10274c1cd7 simplify prev 2026-02-24 17:57:58 +00:00
SomberNight 0b2c7a8a38 lnsweep: safer maybe_reveal_preimage_for_htlc, add "is_preimage_public"
"When should we reveal preimages onchain?"
This commit tries to simplify the thinking by making the observation:
- we can reveal preimages (actually in any context) if they are already public
- a preimage is public if any other lightning node knows it besides us
  - if we learn the preimage from another LN node, it is public
  - if we send update_fulfill_htlc, it becomes public
  - if we see a preimage onchain, it is public

- in lnsweep._maybe_reveal_preimage_for_htlc:
  - partial mpp check is not relevant if preimage is already public
  - let's just always do KeepWatchingTXO, for sanity/safety

Co-authored-by: ThomasV <thomasv@electrum.org>
2026-02-24 17:49:15 +00:00
ThomasV 6feb992712 Merge pull request #10453 from f321x/debug_rbf_fee_calculation
wallet: estimate base tx feerate based on original base tx size
2026-02-24 16:45:07 +01:00
f321x 3133148acd transaction: extend estimated_size() docstring
Extends the docstring of Transaction.estimated_size().

Co-Authored-By: SomberNight <somber.night@protonmail.com>
2026-02-24 14:37:06 +01:00
f321x e9ac3e93d7 transaction: use dummy DER ECDSA sig from descriptor.py
We have two different dummy der signatures of varying size,
this unifies them to use a single one from descriptor.py.
2026-02-24 14:37:04 +01:00
f321x f1e792cc7b test_wallet_vertical: test bump_fee raises for too low fee
Test that Abstract_Wallet.bump_fee() raises if the given feerate
of the replacement is equal to the feerate of the tx to bump as this
wouldn't be accepted to the mempool.
2026-02-24 14:37:02 +01:00
f321x 6c143fa946 test_wallet_vertical: add test for dscancel fee estimate
Check that dscancel properly raises CannotDoubleSpendTx if the
feerate of the new tx is lower than the tx to be cancelled.
2026-02-24 14:37:01 +01:00
f321x 6e1bf7c4fb test_wallet_vertical: add test for batch tx fee increase
Adds unittest to check the fee increase when adding outputs to a base
tx. Supposed to prevent creating transactions that don't get accepted
like in this traceback:
```
broadcast_transaction error [DO NOT TRUST THIS MESSAGE]: "RPCError(1, 'the transaction was rejected by network rules.\\n\\ninsufficient fee, rejecting replacement ceeaef5ac7f82286e42ebd530e965fa4c7a6c11933d6b89d6d6f0ee2c69db839; new feerate 0.00001109 BTC/kvB <= old feerate 0.00001110 BTC/kvB
```
2026-02-24 14:36:59 +01:00
f321x a9f20e4d3d wallet: rbf: estimate base tx size before stripping
Estimate the size of a base tx before stripping its signatures
so the lower bound feerate used to calculate the fee for the rbf
transaction doesn't underestimate the feerate of the base tx.
2026-02-24 14:36:50 +01:00
ghost43 8427a11a5f Merge pull request #10493 from f321x/gossip_fix_save_remote_update
lnpeer: don't try saving our own channel update as remote update
2026-02-23 16:35:13 +00:00
ghost43 cb97200933 Merge pull request #10494 from f321x/console_font_size
qt: console: allow changing font size
2026-02-23 16:33:08 +00:00
f321x 2df68d9249 qt: console: allow changing font size
Allows changing the font size in the qt Console with
`Ctrl` + `+` and `Ctrl` + `-`.
2026-02-23 17:27:39 +01:00
f321x ddb01f5355 lnpeer: don't save our own channel update as remote upd
I noticed CLN is sending our own channel update to us on
reestablishment, we then assume it to be the remote nodes
update and try to verify the signature against their pubkey
which fails and throws `InvalidGossipMsg`.

This adds a check preventing us from trying to save our own
channel updates as remote update.
2026-02-23 17:12:15 +01:00
ghost43 9a71382c5a Merge pull request #10479 from SomberNight/202602_locale_fancy_names
locale: gui: show translation completion percentage in language names
2026-02-21 04:07:54 +00:00
SomberNight 4d2ea4f22c update locale
This includes https://github.com/spesmilo/electrum-locale/pull/54,
which adds the new "X-Electrum-SourceStringCount" header into the .po/.mo files.
2026-02-21 03:51:52 +00:00
SomberNight 3afa2fcdf3 locale: gui: show translation completion percentage in language names
In the GUIs, on the language-select screen, show e.g.
  Czech (100%), Danish (13%), Dutch (54%)
instead of
  Czech, Danish, Dutch

- we count the source strings when creating the .pot PO-template file
  and add an "X-Electrum-SourceStringCount" header to it, in the push_locale.py script that uploads the .pot file to crowdin.
  - later, when we run electrum-locale/update.py to download the translations in .po files, these files will also contain the same header.
  - then when the build_locale.sh script compiles those .po files, we can read the header and use it to populate a new "stats.json" file
    that we place in electrum/locale/locale/ and bundle in the all release binaries/distributables.
    - stats.json also includes the number of translated strings for each lang
- at runtime we simply read stats.json and use the values to calculate the percentages
  - a prior implementation did not pre-calc stats.json but did all calculations at runtime (by opening all .mo translations)
    - however that was deemed to slow, hence the build-time pre-calc
      - runtime calc took 40 ms on my laptop, so I guess it could easily take 10x that on an old phone
- just as we have always been very tolerant of any locale files or even the whole locale/ dir missing, we also tolerate stats.json missing
2026-02-21 03:40:09 +00:00
SomberNight 6de3fef717 (trivial) consistent whitespaces in .gitmodules 2026-02-20 16:30:48 +00:00