1
0
Commit Graph

18319 Commits

Author SHA1 Message Date
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
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
f751a77a65 lnworker: use MIN_FUNDING_SAT as lower bound for channel open 2025-04-07 13:09:09 +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
SomberNight
b13de0afb5 lnpeer: request_gossip: change log line format
before/after:
`requesting channel graph since Fri Apr  4 17:19:05 2025`
`requesting channel graph since 2025-04-04T17:20:04`
2025-04-04 17:23:26 +00:00
ThomasV
dee76b2137 Merge pull request #9660 from f321x/swap_announce_liquidity
swaps: Announce available liquidity instead of static maximum value
2025-04-04 18:04:34 +02:00
f321x
6e8bdb346a move onchain balance calculation to wallet.py 2025-04-04 15:08:51 +02:00
f321x
17a9a91e1f announce actual available liquidity as swap provider 2025-04-04 15:06:50 +02:00
ThomasV
1405f02c0a Merge pull request #9696 from f321x/fix_node_ann_exception
lightning: fix exception if LIGHTNING_LISTEN is not set on public node
2025-04-04 14:22:58 +02:00
f321x
db55e37277 fix exception if LIGHTNING_LISTEN is not set on public node 2025-04-04 12:20:48 +02:00
f321x
03018fa218 make txbatcher wait for network connection 2025-04-04 11:43:24 +02:00
ThomasV
181c132fee Merge pull request #9666 from accumulator/qml_close_invoicedialog_after_onchain_broadcast_success
qml: auto close invoicedialog after successful onchain tx broadcast
2025-04-03 17:18:31 +02:00
Sander van Grieken
f76218ea83 qml: introduce InfoBanner allowing a clickable sticky message to stay below header and
implement ln utxo reserve check with warning. Clicking shows a suggestion to swap.
2025-04-03 14:39:05 +02:00
Sander van Grieken
3fd64b60ab qml: show warning in ConfirmTxDialog if max amount cannot be fully sent due to channel reserve requirements. 2025-04-03 14:39:05 +02:00
ThomasV
001a1152fd add unit tests for ln_utxo_reserve 2025-04-03 14:39:05 +02:00
ThomasV
32807462b0 qt: add warning about low utxo reserve 2025-04-03 14:39:05 +02:00
ThomasV
b339b1e7e3 ln_utxo_reserve
When we send max, decrease sent amount in order to keep some
reserve utxo, in order to be able to sweep lightning channels.
2025-04-03 14:39:05 +02:00