Commit Graph

751 Commits

Author SHA1 Message Date
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
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
f321x 4556d59fc0 plugin: nwc: qt: fix thread safety bug
Call `NWCServer.event_handler_task.cancel()` on asyncio thread.

```
 File "/home/user/Documents/electrum/electrum/plugins/nwc/nwcserver.py", line 281, in restart_event_handler
   self.event_handler_task.cancel()
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
 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-02-16 09:28:16 +01:00
SomberNight 0c33994d70 plugins: hardware: HardwareHandlerBase.show_error() takes str, not exc
This is just a minor conceptual clean-up,
runtime behaviour is not being changed, as ultimately, much later in the exec flow,
the msg object being passed around is cast to str already.
(e.g. see str(text) at https://github.com/spesmilo/electrum/blob/4f7b6e897710338e8a4cfb8fa97c305218bdff88/electrum/gui/qt/util.py#L375-L379)
2026-02-12 17:04:20 +00:00
ghost43 6083808191 Merge pull request #10461 from romanz/ts5
Support TS5 in `TrezorClientBase.device_model_name()`
2026-02-04 02:26:26 +00:00
Roman Zeyde 38a0acffb4 Support TS5 in TrezorClientBase.device_model_name() 2026-02-03 21:37:29 +01:00
Ben Gridley 2c058c97eb add support for Nano Gen5 2026-02-01 16:35:04 -07: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 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
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
f321x 095debcded plugin: timelock recovery: more i18n 2025-12-15 11:52:57 +01:00
ghost43 0b886cf7a8 Merge pull request #10272 from accumulator/timelock_recovery_destination_validation
timelock_recovery: recovery destination checks for address is_mine or script output
2025-12-11 19:08:09 +00:00
f321x aa47a960a7 ledger: throw UserFacingException for OSError
Throws UserFacingException if the communication with the ledger fails
due to an OSError. This happens e.g. if the Bitcoin app has been closed.
We shouldn't get crash reports for errors due to disconnection.
2025-12-10 16:48:17 +01:00
ghost43 f8fc2b63e3 Merge pull request #10271 from f321x/fix_save_payment_info
lightning: fix self payments (e.g. rebalance)
2025-12-05 17:19:39 +00:00
SomberNight 75ac8bcee1 plugins: nwc: don't mutate aionostr Event
I want to change the Event class to be immutable.
2025-12-04 00:47:32 +00:00
f321x 923d48f9db lnworker: differentiate PaymentInfo by direction
Allows storing two different payment info of the same payment hash by
including the direction into the db key.
We create and store PaymentInfo for sending attempts and for requests (receiving),
if we try to pay ourself (e.g. through a channel rebalance) the checks
in `save_payment_info` would prevent this and throw an exception.
By storing the PaymentInfos of outgoing and incoming payments separately in
the db this collision is avoided and it makes it easier to reason about
which PaymentInfo belongs where.
2025-12-01 18:39:56 +01:00
Sander van Grieken 0f2a41e078 simple_config: factor out self.decimal_point and self.get_decimal_point() in favor of self.BTC_AMOUNTS_DECIMAL_POINT 2025-11-27 12:38:49 +01:00
ThomasV 9f50d2a61d Merge pull request #10276 from f321x/2fa_conf_qt
trustedcoin: qt: set higher minimumHeight for QR component
2025-11-27 10:39:42 +01:00
ThomasV d36b753cfe remove plugin payserver (moved to spesmilo/electrum-payserver) 2025-11-25 11:40:25 +01:00
ThomasV 9c4c7f01ac daemon: pass cmdname to register_method
This allows plugins to use already existing names without Electrum complaining about collisions
2025-11-04 12:42:54 +01:00
f321x f402cb3cd1 plugin: watchtower: call start_watching() threadsafe
Launch `WatchtowerPlugin.watchtower.start_watching()` through
asyncio.run_coroutine_threadsafe instead of ensure_future to prevent the
following exception from happening when running python with
`PYTHONASYNCIODEBUG=1`.

```

20251103T165007.087746Z |    ERROR | plugin.Plugins | cannot initialize plugin watchtower: Error loading watchtower plugin: RuntimeError('Non-thread-safe operation invoked on an event loop other than the current one')
Traceback (most recent call last):
  File "/home/user/code/electrum-fork/electrum/plugin.py", line 629, in load_plugin_by_name
    plugin = module.Plugin(self, self.config, name)
  File "/home/user/code/electrum-fork/electrum/plugins/watchtower/watchtower.py", line 59, in __init__
    asyncio.ensure_future(self.watchtower.start_watching())
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.14/asyncio/tasks.py", line 732, in ensure_future
    return loop.create_task(coro_or_future)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.14/asyncio/base_events.py", line 468, in create_task
    return self._task_factory(self, coro, **kwargs)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/code/electrum-fork/electrum/util.py", line 1773, in factory
    task = asyncio.Task(coro, loop=loop_, **kwargs)
  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

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/code/electrum-fork/electrum/plugin.py", line 184, in load_plugins
    self.load_plugin_by_name(name)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/user/code/electrum-fork/electrum/plugin.py", line 631, in load_plugin_by_name
    raise Exception(f"Error loading {name} plugin: {repr(e)}") from e
Exception: Error loading watchtower plugin: RuntimeError('Non-thread-safe operation invoked on an event loop other than the current one')

```
2025-11-03 17:54:48 +01:00
f321x d954ddf0bd trustedcoin: qt: set higher minimumHeight for QR component
The default minimumHeight for wizard components is a bit small for the
2fa confirmation component as it only shows the QR code but not the
input field. This seems to confuse users as its not intuitive to scroll
down if there is no large text shown (as for example in the ToS component).
This change increases the minimumHeight and restores it to the previous
height once the user leaves the component again.
2025-10-22 14:12:15 +02:00
Sander van Grieken dc417a4f99 timelock_recovery: recovery destination checks for address is_mine or script output
note: validation in frontend should be added to backend code as well
2025-10-20 15:27:38 +02:00
f321x 286fc4b86e lnworker: enforce creation of PaymentInfo for b11
Enforce that the information used to create a bolt11 invoice using
`get_bolt11_invoice()` is similar to the related instance of PaymentInfo
by requiring a PaymentInfo as argument for `get_bolt11_invoice()`.
This way the invoice cannot differ from the created PaymentInfo.
This allows to use the information in PaymentInfo for validation of
incoming htlcs more reliably.

To cover all required information for the creation of a b11 invoice the
PaymentInfo class has to be extended with a expiry and
min_final_cltv_expiry. This requires a db upgrade.
2025-09-30 09:54:35 +02:00
SomberNight b944371ffd adb: change API of util.TxMinedInfo: height() is now always SPV-ed 2025-09-24 13:46:24 +00:00
f321x 708aefb036 swapserver: add commands for stats
Adds two command to the swapserver plugin to retrieve some stats so swap
providers can see more easily what is going on on their swapserver.
2025-09-05 15:39:51 +02:00
f321x 5f0180910c qml: add padding to ElDialog for android e2e 2025-08-27 15:17:16 +02:00
SomberNight 81be0554a3 swaps: more robust parsing 2025-08-19 13:42:21 +00:00
ghost43 e7c8377808 Merge pull request #10128 from f321x/fix_4111
fix: psbt_nostr: don't save tx without txid
2025-08-18 16:30:16 +00:00
SomberNight f8926b4957 type-hint some Callables
could not figure out how to type-hint coinchooser.sufficient_funds with typing.Protocol,
at least PyCharm complained on all my attempts
2025-08-18 15:38:25 +00:00
SomberNight 0ceb54b61f wallet: enable/disable_keystore: rm functionality from 2fa wallets
was already not working, but does not even really make sense without larger changes
2025-08-15 16:18:13 +00:00
f321x 478fb483e9 fix: psbt_nostr: don't allow to save tx without txid
Stops the psbt nostr plugin from trying to save transactions without
txid to the wallet history and doesn't give the user the option to do
so.
2025-08-13 10:45:52 +02:00
Oren 9487589e06 Fix typo
website is mempoi.space, not
mempool.space.com
2025-07-27 12:12:39 +03:00
SomberNight b0464cc934 refactor 'init_wallet_wizard' hook a bit. add test_wizard trezor test 2025-07-21 02:40:17 +00:00
SomberNight bfd3c0e48c Merge branch spesmilo/pr/10016' into 202507_pr10016_qml_wizard_passphrase 2025-07-20 22:02:01 +00:00
Marko Bencun 6567e01f61 bitbox02: update to 7.0.0
This adds support for BitBox02 Nova devices.
2025-07-17 12:07:24 +02:00
SomberNight 3c82b00c5e WalletDB() usage: trivial refactors and fixes
split off from https://github.com/spesmilo/electrum/pull/10027
2025-07-15 12:30:06 +00:00
f321x 1bb8e2d468 adapt trustedcoin to updated passphrase flow in wizard 2025-07-15 00:19:40 +02:00
SomberNight a1a55db39c lnwatcher: keep_watching should wait at least until closing_tx is deep
Even if it decides there is nothing to sweep from the ctx/etc, it still needs to
keep watching until a reorg-safe depth.
2025-07-08 13:36:04 +00:00
ghost43 08965d93c4 Merge pull request #10006 from shangchenglumetro/master
chore: fix some minor issues in the comments
2025-07-05 23:54:43 +00:00
f321x f597436fd9 revealer: improve code formatting 2025-07-05 14:13:27 +02:00
f321x 9495aabc8c fix: do not catch exception in revealer plugin
exceptions thrown inside `create_noise_file()` were catched and
couldn't reach the `CrashReporter`.
2025-07-05 14:10:01 +02:00
shangchenglumetro deca7837f1 chore: fix some minor issues in the comments
Signed-off-by: shangchenglumetro <shuang.cui@live.com>
2025-07-04 16:28:47 +08:00
Oren afc62ebb77 Ok to press Sign and not save as a file
It's ok to click the View button, then
press Sign, and then close the window

the signed transaction will be used
by the on_closed callback
2025-07-03 15:50:12 +03:00