1
0
Commit Graph

18332 Commits

Author SHA1 Message Date
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
f321x
cb4837f1b3 trigger payment_failed only once on htlc timeout tx failing 2025-04-07 13:00:29 +02:00
accumulator
746c13b32d Merge pull request #9674 from accumulator/qml_lightning_invoice_insufficient_balance
qml: show insufficient balance text for lightning invoice without fal…
2025-04-07 12:09:17 +02:00
accumulator
dc3c7956c0 Merge pull request #9703 from f321x/open_channel_dialog_fix
qml: call QEChannelOpener.validate() on updateMaxAmount
2025-04-07 11:58:13 +02:00
f321x
8d84008f5b disable output value rounding for 0 fee tx and remove relay fee warning from gui 2025-04-07 11:52:43 +02:00
f321x
8b7e967555 call QEChannelOpener.validate() on updateMaxAmount 2025-04-07 10:16:48 +02:00
Sander van Grieken
71801de7ea qml: show insufficient balance text for lightning invoice without fallback and insufficient ln send capacity 2025-04-07 10:02:25 +02:00
ThomasV
282c4561ff swapsserver fix for legacy clients. (follow-up 6e92a00) 2025-04-05 18:17:06 +02:00
accumulator
bc4fcd8b83 Merge pull request #9682 from accumulator/android_permissions_support
Android >=13 permissions support
2025-04-05 11:47:27 +02:00
SomberNight
f429af7d01 lnutil: cache validate_features() results
channel_db.load_data() is slow, slowing down startup time (when trampoline is disabled).
util.list_enabled_bits() is one of the main contributors to the slowness, called by validate_features().

One could argue that we could even simply *not* call validate_features for gossip messages as part of load_data,
as they have already been validated before storing them in the db. However re-validating them there is a good
clean-up/sanity check IMO. Note that what is considered "valid" can change over time, so just because validate_features
passed when we originally received and stored a gossip message, it might no longer be valid a year later if the bolts change.

This caching decreases the time needed for load_data on two different machines / gossip dbs as below:
47 sec -> 10 sec
18 sec -> 6 sec

If instead of caching, I just rm the validate_features() calls, the benchmarks are almost identical, within noise.
That is, the cache looks really effective.
(the rest of the slowness is mostly due to lnmsg.decode_msg)

```
>>> lnutil.validate_features.cache_info()
CacheInfo(hits=172674, misses=287, maxsize=1000, currsize=277)
```

-----

We could alternatively directly cache util.list_enabled_bits (instead of validate_features).
That would be a bit slower and might end up using a lot more memory in some cases I think, but maybe conceptually would be cleaner.
Also note that if validate_features() raises an exception, that is not cached.
2025-04-04 18:24:50 +00:00