1
0
Commit Graph

18341 Commits

Author SHA1 Message Date
f321x
8d79c58c5e Stop including all invoice r_tags in legacy trampoline onion
This change modifies create_trampoline_onion to only include as many
available r_tags as there is space left in the trampoline onion payload.

Previously we tried to include all passed invoice r_tags of legacy
trampoline payments into the payload which caused an user facing
exception and payment failure as the onion can only store a max of 400
bytes.
A single, single hop r_tag is around 52 bytes and the payload
without r_tags is already at ~280 bytes. So usually there is enough
space for 2 r_tags.
The implementation shuffles the r_tags on each call
so the payment will try different route hints on the attempts (fee level
increase or user retry).

I have logged the following byte sizes of the trampoline onion with a 2
trampoline onion hop and changing amounts of r_tags:

3 rtags:
payload size [0]: 113 (hop size: 81)
payload size [1]: 440 (hop size: 295) ( 52 bytes/rtag )
payload size [2]: 550 (hop size: 78)

2 rtags:
payload size [0]: 113 (hop size: 81)
payload size [1]: 386 (hop size: 241) ( 52 bytes/rtag )
payload size [2]: 496 (hop size: 78)

1 rtag:
payload size [0]: 113 (hop size: 81)
payload size [1]: 334 (hop size: 189) ( 52 bytes/rtag )
payload size [2]: 444 (hop size: 78)

0 rtags:
payload size [0]: 113 (hop size: 81)
payload size [1]: 282 (hop size: 137)
payload size [2]: 392 (hop size: 78)

As can be seen in the data, using 2 trampoline hops there is not enough
space for even a single r_tag which is why this option is being removed
too.
2025-04-14 19:20:11 +02:00
ThomasV
eff8b65355 Plugins: pass wallet to settings_dialog
Also, remove settings_widget method.
The widget should always be a button.

nwc: is_initialized -> initialized
2025-04-12 11:09:15 +02:00
ThomasV
3a18000f7a nwc plugin: settings_dialog is wallet agnostic.
instead, test wallet in start_plugin.
prevent plugin from using several wallets.
2025-04-11 20:16:59 +02:00
ThomasV
13024be4da nwc plugin: fix config key 2025-04-11 20:06:42 +02:00
ThomasV
bcb6df72a7 Merge pull request #9729 from spesmilo/recursive_config
recursive config file
2025-04-11 20:02:25 +02:00
SomberNight
bd0085e680 tests: commands: add test_setconfig_none 2025-04-11 17:17:53 +00:00
ThomasV
8f3490c87e recursive config file
move plugin variables into sub dictionaries of user config
2025-04-11 19:06:48 +02:00
ThomasV
58cd626463 Merge pull request #9723 from f321x/lightning_pay_assertion_error
lightning: prevent usage of unavailable channels for payment
2025-04-11 14:19:58 +02:00
f321x
f1900e493d Fix assertion error in ln payments when using same seed in multiple wallets.
Make path calculation check if channel is not in our sending channels but still uses our nodeID as starting node of the path.

I noticed an assertion error when trying to pay an invoice from a seed i have opened channels with in different wallet instances (same seed, different wallet).
Because the channel seemed suitable for sending the payment path finding included the channel for sending in the first position of the route but then
in pay_to_route the channel for route[0] could not be found as it is not included in our channel list, causing the assert and payment to fail.
2025-04-11 14:04:51 +02:00
ThomasV
875cb24665 Merge pull request #9707 from f321x/fix_receive_unknown_htlc_failed
lightning: trigger payment_failed only once in LNWallet.htlc_failed().
2025-04-11 12:39:25 +02:00
ThomasV
a500d5194d make plugins dialog available in tray
This makes it possible to install a third-party plugin from
the wizard, before creating a wallet, e.g. for a hardware wallet.
2025-04-11 10:27:34 +02:00
ThomasV
e084789577 minor fix (follow-up 737417fb80) 2025-04-11 10:05:58 +02:00
ThomasV
de047195a9 Allow zip plugins to register keystore
This makes it possible to create external plugins that add support
for hardware wallets.
2025-04-11 09:20:57 +02:00
ThomasV
737417fb80 Userspace plugins:
- Allow plugins saved as zipfiles in user data dir
 - plugins are authorized with a user chosen password
 - pubkey derived from password is saved with admin permissions
2025-04-11 08:45:28 +02:00
accumulator
bd5de52768 Merge pull request #9697 from accumulator/qml_buttons
qml: add ellipsis to buttons that are followed by another chance to bail
2025-04-10 19:52:56 +02:00
Sander van Grieken
ad4aafa2e4 qml: add ellipsis to buttons that are followed by another chance to bail 2025-04-10 19:52:44 +02:00
SomberNight
5c17f452b1 tests: util.custom_task_factory: fix res warn "coro was never awaited"
follow-up 70d1e1170e

```
=============================== warnings summary ===============================
tests/test_util.py::TestUtil::test_custom_task_factory
  /tmp/cirrus-ci-build/tests/test_util.py:504: RuntimeWarning: coroutine 'TestUtil.test_custom_task_factory.<locals>.foo' was never awaited
    self.assertEqual(foo().__qualname__, task.get_coro().__qualname__)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

```
2025-04-10 13:10:58 +00:00
accumulator
ca01830ea5 Merge pull request #9708 from accumulator/qml_channelopener_user_feedback
qml: when opening channel, validate and show user feedback if amount outside acceptable range
2025-04-10 13:30:47 +02:00
ThomasV
f2692b7f2d Merge pull request #9721 from spesmilo/move_hw_wallet
move hw_wallet module from plugins to electrum library
2025-04-10 12:13:42 +02:00
ThomasV
c5e9ef558f Merge pull request #9675 from f321x/nwc
plugin: implement Nostr Wallet Connect (NIP47) plugin
2025-04-10 10:58:16 +02:00
accumulator
e4fc4980ab Merge pull request #9720 from accumulator/qml_singletons
qml: simplify QEConfig and QEDaemon use.
2025-04-10 10:23:29 +02:00
f321x
253ab6849a implement NIP47 plugin 2025-04-10 10:22:29 +02:00
accumulator
61a1ef7504 Merge pull request #9676 from accumulator/qml_send_to_same_address_invoice_status_fix
qml: don't confuse second payment to same address with previous uncon…
2025-04-10 10:21:02 +02:00
ThomasV
6e087950cf move hw_wallet.py from plugins to electrum library 2025-04-10 10:19:15 +02:00
SomberNight
6584ae2ef8 transaction: add note serialize_preimage is not caching Sighash.SINGLE
Unlike a full bitcoin node, we rarely (if ever) validate the signatures of arbitrary transactions,
so I don't think these DOS issues can really be used against us.

ref https://rubin.io/bitcoin/2025/03/11/core-vuln-taproot-dos/
ref https://github.com/bitcoin/bitcoin/pull/24105

btw what is not explained in either source link is that the lack of caching is much
more serious for taproot as bip-342 lifted the 10 kbyte max size for scriptPubKeys.
2025-04-09 15:28:13 +00:00
Sander van Grieken
eb29b7c95c qml: simplify QEConfig and QEDaemon use.
force QEDaemon singleton, and refer to QEDaemon.instance where possible
In cases where we would run into circular dependencies, pass the instance

also refer to singleton QEConfig instead of passing instance in qeapp.py
2025-04-09 13:44:26 +02:00
Sander van Grieken
7391a1039d qml: don't confuse second payment to same address with previous unconfirmed payment to that address
QEInvoiceParser creates a zero amount output invoice when pasting an address, which would return the
wrong status when calling wallet.get_invoice_status() (there is some address heuristic in
wallet._is_onchain_invoice_paid which is associating with the previous payment)
2025-04-09 13:19:46 +02:00
ThomasV
4ecf6acc1c Merge pull request #9691 from f321x/send_change_to_lightning
swaps: improve send change to lightning and swapserver error handling
2025-04-09 13:18:54 +02:00
ThomasV
1494cca486 Merge pull request #9681 from f321x/txbatcherror
wallet: make txbatcher wait for network connection
2025-04-09 12:44:57 +02:00
ThomasV
0f20761465 Merge pull request #9719 from f321x/reduce_logging_of_swap_nostr_transport
swaps: Reduce logging verbosity of aionostr.Manager in swap transport
2025-04-09 12:33:20 +02:00
f321x
c27035219a Set log level of logger passed to the aionostr.Manager to INFO because the debug log output of Manager is very verbose (showing single websocket messages etc.). This still provides enough useful information for debugging purposes. 2025-04-09 12:26:28 +02:00
ThomasV
fe11fa3f4f Merge pull request #9716 from f321x/fix_swap_exception
swaps: make swap transport use shared timeout value
2025-04-09 12:06:52 +02:00
accumulator
96793d6e43 Merge pull request #9713 from accumulator/improve_not_enough_funds_mentioning_frozen
wallet,gui: improve not_enough_funds_mentioning_frozen
2025-04-09 09:33:41 +02:00
Sander van Grieken
d28899c572 wallet,gui: improve not_enough_funds_mentioning_frozen 2025-04-09 09:32:21 +02:00
SomberNight
220e6a1ef9 Merge branch 'pr/9717': re asyncio.Event.set() race conditions
see https://github.com/spesmilo/electrum/pull/9717
plus local follow-up clean-up
2025-04-08 19:56:38 +00:00
SomberNight
4b9d874d13 util: add fn run_sync_function_on_asyncio_thread
note: the return value is not propagated out.
It would be trivial to do that for the block=True case - but what about block=False?
2025-04-08 19:53:49 +00:00
SomberNight
70d1e1170e asyncio: clarify strong refs for run_coroutine_threadsafe
We added some code in 0b3a283586
to explicitly hold strong refs for all tasks/futures. At the time I was uncertain if that also solves
GC issues with asyncio.run_coroutine_threadsafe.
ref https://github.com/spesmilo/electrum/pull/9608#issuecomment-2703681663

Looks like it does. run_coroutine_threadsafe *is* going through the custom task factory.
See the unit test.
The somewhat confusing thing is that we need a few event loop iterations for the task factory to run,
due to how run_coroutine_threadsafe is implemented. And also, the task that we will hold as strong ref
in the global set is not the concurrent.futures.Future that run_coroutine_threadsafe returns.

So this commit simply "fixes" the unit test so that it showcases this, and removes related, older, plumbing
from util.py that we now know is no longer needed because of this.
2025-04-08 18:54:58 +00:00
f321x
216bfe3b50 fix race condition causing initialize_swap_manager assert to fail by waiting for trigger_pairs_updated_threadsafe to set the is_initialized event before returning if it is not running on the aio loop 2025-04-08 19:00:05 +02:00
f321x
aace9aab91 make swap transport use shared timeout value 2025-04-08 17:44:17 +02:00
ghost43
aef2a7a8a9 Merge pull request #9705 from accumulator/qml_freeze_reused_address_utxos
qml: add config option WALLET_FREEZE_REUSED_ADDRESS_UTXOS
2025-04-08 14:07:57 +00:00
Sander van Grieken
6e8f97d36a qml: add config option WALLET_FREEZE_REUSED_ADDRESS_UTXOS 2025-04-07 19:48:20 +02:00
SomberNight
cca29eff72 contrib/push_locale: minor clean-up 2025-04-07 17:17:39 +00:00
SomberNight
ef452b1f49 contrib/push_locale: update qt5->qt6 2025-04-07 17:16:02 +00:00
ghost43
5dad7c55fd Merge pull request #9704 from f321x/future_tx_fee
tx / gui: Disable output value rounding for 0 fee tx and don't show relay fee warning in gui
2025-04-07 15:40:11 +00:00
f321x
42bd334f5b add coinchooser test with zero fee estimation 2025-04-07 17:14:25 +02:00
ghost43
d86276042a Merge pull request #9706 from accumulator/lnworker_channelopen_min_amount
lnworker: use MIN_FUNDING_SAT as lower bound for channel open
2025-04-07 14:42:14 +00:00
ThomasV
ddf836935e Merge pull request #9709 from f321x/fix_fee_slider_qml_channel_open
qml: pass updated fee policy to make_tx function when opening channel
2025-04-07 15:05:53 +02:00
f321x
23c0887a5c qml: pass updated fee policy to make_tx function when opening channel 2025-04-07 14:08:15 +02:00
Sander van Grieken
8b54f6445c qml: when opening channel, validate and show user feedback if amount outside acceptable range 2025-04-07 13:25:47 +02:00
Sander van Grieken
f751a77a65 lnworker: use MIN_FUNDING_SAT as lower bound for channel open 2025-04-07 13:09:09 +02:00