Commit Graph

729 Commits

Author SHA1 Message Date
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
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
Oren 951ca76fc2 allow signing transaction from View 2025-07-03 15:50:12 +03:00
Oren fb40bbe96b keep the same locktime
We don't want the txid to change because
the new transaction has a new random locktime.
2025-07-03 15:50:12 +03:00
Oren 2e96886960 labels to show signed txes 2025-07-03 15:50:12 +03:00
Oren fb535516d3 Rename labels to fee labels 2025-07-03 15:50:12 +03:00
Oren 78c0425931 return tx in on_closed callback 2025-07-03 15:50:12 +03:00
Oren 7eb29f9a6b watch-only wallets should sign externally
The Next button should be clicked
only after the transactions have been signed
2025-07-03 15:50:12 +03:00
Oren d1a15ae8f6 throw exception if signing is not complete
There could be flows where sign_transaction
will return without actually
signing the transaction.

We also want to add the ability to sign
the transactions externally, so here we check
if they are already signed.
2025-07-03 15:50:12 +03:00
Oren ac38b4a594 don't use config FEE_POLICY
Long Term recovery transactions should have
a high fee policy, because we don't know when
we will broadcast them.

On the other hand, they won't need to be urgent
when broadcasted either.
2025-07-03 15:50:12 +03:00
cloudclaim 06d1b730b7 chore: fix some minor issues in the comments
Signed-off-by: cloudclaim <824973921@qq.com>
2025-06-29 10:07:38 +08:00
ThomasV f6075a5825 follow-up ba3783f998 2025-06-19 09:44:56 +02:00
ThomasV 4714fdfba2 plugins: add icons to manifest.json 2025-06-17 10:45:03 +02:00
Sander van Grieken 3c9c6a286c imports, whitespace, type hints, copyright headers 2025-06-12 14:32:00 +02:00
Sander van Grieken 2c7afacbe1 timelock_recovery: remove redundant pi.parse_output() call and use pi fields directly 2025-06-12 10:07:28 +02:00
ThomasV b8761ca006 payserver plugin: fix config var names 2025-06-10 20:39:14 +02:00
ghost43 448cbc7869 Merge pull request #9936 from f321x/nwc_incoming_event_filtering
plugin: nwc: improve filtering of expired requests
2025-06-10 18:32:13 +00:00
f321x 0f442f4c85 plugin: nwc: improve filtering of expired requests
improve the filtering of incoming requests by checking if they have
explicitly set an expiration tag. If so, they will only be ignored if
this timestamp is exceeded. Otherwise requests older than 30 secons will
get ignored and an error will get sent to the client so the client is
aware it's request arrived too late.
This is done to prevent handling requests the user may already expects
to have failed.
2025-06-10 19:29:19 +02:00
SomberNight 527d9e8215 plugins: nwc: clean-up imports
Try to follow PEP-8 import grouping, to make things readable.
I want to be able to quickly spot 3rd-party library imports! :P
2025-06-10 15:22:13 +00:00
SomberNight dd7a284fd9 plugins: nwc: fix constants.net import
"# don't import net directly, import the module instead (so that net is singleton)"

set_as_network does not work if net is not a singleton, it results in a split worldview.
2025-06-10 15:22:10 +00:00
SomberNight 65bc28056c plugins: psbt_nostr: trivial rename
pycharm static analyser was getting confused and thinking this line was rebinding "_" from i18n._
(but AFAICT that's a bug in the static analyser)
2025-06-10 15:01:27 +00:00
SomberNight f846a16f07 plugins: psbt_nostr: add comment about testnet/mainnet separation 2025-06-10 15:01:24 +00:00
SomberNight bbe3350937 plugins: psbt_nostr: use wallet.up_to_date_changed_event 2025-06-10 15:01:20 +00:00
ThomasV 2024fa4507 Merge pull request #9902 from SomberNight/202506_base64_trailing_garbage
base64.b64decode: always set validate=True
2025-06-04 14:59:20 +02:00