Commit Graph

8023 Commits

Author SHA1 Message Date
SomberNight 7737dbf795 plugins: ledger: fix Ledger_Client_Legacy.sign_transaction
regression from https://github.com/spesmilo/electrum/commit/2f1095510c2f50bfe2c2ebc0c7159e9b8f945aca
2025-03-18 15:34:17 +00:00
ThomasV 38f9cac48c Merge pull request #9649 from f321x/move_commands_to_init
Move plugin commands to init file of plugin
2025-03-18 11:14:30 +01:00
f321x e74029c880 move plugin commands to init file of plugin 2025-03-18 09:37:07 +01:00
SomberNight c8143957a6 plugins: keepkey: rm dependence on external keepkeylib
we will instead bundle our own fork, as a git submodule,
https://github.com/spesmilo/electrum-keepkeylib

related https://github.com/spesmilo/electrum/issues/7922
and https://github.com/keepkey/python-keepkey/issues/146
(i.e. upstream keepkeylib is unmaintained)
2025-03-17 17:53:48 +00:00
SomberNight 457979ce63 plugin.py: fix plugin.read_file
follow-up https://github.com/spesmilo/electrum/commit/246f03fe20b1cd65728f68b6937f73e3ef184b25
2025-03-17 17:52:31 +00:00
f321x 246f03fe20 allow all plugins to be either zip or directory based 2025-03-17 16:27:33 +01:00
Oren e658d9118a fix base_tx type
base_tx in make_unsigned_transaction
is expected to be of type
Optional[Transaction], not boolean.
2025-03-17 14:54:48 +02:00
ThomasV 3463e68306 add accounting addresses 2025-03-17 10:47:19 +01:00
ThomasV 2133427f53 fix issue #9543 2025-03-17 10:46:00 +01:00
ThomasV 58be5a3ad5 Allow wallets to use non-deterministic lightning,
if they use a software keystore.

This excludes hardware wallets and watching-only wallet.
Also, this forbids creation of new channels in those wallets,
in case lightning was previously enabled.

Fixes #9440
2025-03-17 09:51:52 +01:00
ThomasV f8714dd57a fix #9635 2025-03-16 17:01:07 +01:00
ThomasV 9d1ffe0c37 support for arguments to plugin commands:
- add a simple parser that only figures out where the config is,
   and does not complain if args are unknown
2025-03-16 15:01:22 +01:00
ThomasV d2fa404e06 plugin commands: load the plugin in func_wrapper 2025-03-16 12:26:31 +01:00
ThomasV 51890fd0b5 Merge pull request #9629 from f321x/plugin-commands
Allow plugins to register CLI commands
2025-03-16 12:09:09 +01:00
ThomasV a474b8674d plugin commands:
- make plugin commands start with plugin name + underscore
 - plugin_name must be passed to the plugin_command decorator
 - fixes:
    - remove plugin_commands (unneeded)
    - func_wrapper must await func()
    - setattr(Commands, name, func_wrapper)
 - add push/pull commands to labels plugin
2025-03-16 11:53:34 +01:00
ThomasV cb39737a39 Plugins call with cmd_only:
- pass temporary config to Plugins
 - load only enabled plugins
 - parse the command line again after plugins are loaded
2025-03-15 13:31:00 +01:00
f321x ae64583ebc add handling of plugin commands 2025-03-15 13:22:28 +01:00
ThomasV 81d4e90f66 Merge branch 'master' into 140325-force-close-exception 2025-03-14 19:38:13 +01:00
SomberNight 2763e14bb3 commands: payto can just call paytomany 2025-03-14 17:38:45 +00:00
SomberNight 977d8b1dd6 wallet: kill create_transaction 2025-03-14 17:19:41 +00:00
f321x 5edbf923cd fix sweeping anchor outputs with multiple change addresses option enabled, don't consider tx inputs sufficient value if there are no outputs so change outpu gets added 2025-03-14 18:15:04 +01:00
SomberNight 4689a0e78c wallet: towards killing create_transaction: rm "coins" logic 2025-03-14 17:14:59 +00:00
SomberNight cab1dc5c29 wallet: towards killing create_transaction: pass through "locktime", "version" 2025-03-14 17:03:49 +00:00
SomberNight 3c3778db9c wallet: towards killing create_transaction: rm "sign" arg 2025-03-14 16:44:46 +00:00
SomberNight fddd4275aa qt: move "FREEZE_REUSED_ADDRESS_UTXOS" option to utxo_list toolbar
ref https://github.com/spesmilo/electrum/pull/9636
2025-03-14 16:16:55 +00:00
SomberNight 656c109336 qt: refactor TxEditor preferences: use QMenuWithConfig 2025-03-14 16:05:40 +00:00
ghost43 e62a2c43c5 Merge pull request #9634 from SomberNight/202503_is_frozen_futuretx
wallet: consider "future" coins as frozen by default
2025-03-14 14:26:07 +00:00
ThomasV 39224f003d Merge pull request #9636 from SomberNight/202503_avoid_reuse
wallet: add new config option "FREEZE_REUSED_ADDRESS_UTXOS"
2025-03-14 12:56:29 +01:00
ThomasV 8e6be0a36a Remove inheritance between LNWatcher and Watchtower
As LNWatcher is no longer async, there is not enough overlap
between these classes to deserve inheritance
2025-03-14 11:59:56 +01:00
ThomasV fbebe7de1a Make lnwatcher not async
This fixes offline history not having the proper labels
2025-03-14 11:09:11 +01:00
ThomasV 42b072aca8 submarine swaps: formatting 2025-03-14 09:22:32 +01:00
ThomasV fff90a1426 submarine swaps: check preimage before labeling a refund transaction 2025-03-14 09:13:18 +01:00
ThomasV ba2e4ff99a txbatcher: set wanted height for future tx that has unconfirmed parent
also, do not unset it in the subsequent if statement
2025-03-14 09:05:21 +01:00
ThomasV 62f5e7f6bd Merge pull request #9606 from f321x/jit-improve-qml
Handle just in time channels in qml request creation
2025-03-14 08:35:37 +01:00
ThomasV 3adfe9a8de Merge pull request #9598 from f321x/jit-gui-improvements
Handle zeroconf lightning requests in QT gui
2025-03-14 08:34:00 +01:00
SomberNight d52762a2e8 wallet: add new config option "FREEZE_REUSED_ADDRESS_UTXOS"
Adds a new config option: `WALLET_FREEZE_REUSED_ADDRESS_UTXOS`.
This is based on Bitcoin Core's "avoid_reuse" wallet flag. [0]

This opt-in feature, if enabled:
> Automatically freeze coins received to already used addresses.
> This can eliminate a serious privacy issue where a malicious user can track your spends by sending small payments
> to a previously-paid address of yours that would then be included with unrelated inputs in your future payments.

Note that currently we only have a single coinchooser policy, `CoinChooserPrivacy`,
which interacts well with this option, as it spends all coins from any selected address.
However, if we later add a different coinchooser policy, which allowed "partial spends",
care should be taken re e.g. disallowing using that when this option is set.

Also note that this PR adds this as a config option, but arguably it could be wallet-specific instead,
such as `use_change`.

[0]: https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.19.0.1.md#wallet

closes https://github.com/spesmilo/electrum/issues/7497
2025-03-14 00:47:42 +00:00
SomberNight eea1eb5eb0 wallet: consider "future" coins as frozen by default 2025-03-14 00:09:04 +00:00
SomberNight 3ff794da12 wallet: (trivial) refactor is_frozen_coin 2025-03-14 00:07:26 +00:00
SomberNight 80d0d5fddd qt confirm_tx_dialog: show frozen balance if "not enough funds" 2025-03-13 23:32:19 +00:00
SomberNight 8ccd31fe49 wallet: set_frozen_state_of_coins to handle freeze=None
Internally whether a coin is frozen is tri-state:
- forced-True, set by the user
- forced-False, set by the user
- unset/default: is_frozen_coin() can decide whether the coin should be frozen

This patch lets set_frozen_state_of_coins() undo a previous explicit setting of True/False,
by calling it with a value of None.
Note: there is still no way in the GUI to undo an explicit setting of True/False.
2025-03-13 18:32:58 +00:00
ThomasV 9351183876 Merge pull request #9633 from f321x/fix-qml-swap-exception
Use FeePolicy in qeswaphelper to fix exception
2025-03-13 18:01:23 +01:00
f321x 601ff7f731 use FeePolicy in qeswaphelper 2025-03-13 17:31:42 +01:00
SomberNight 089568430d lnchannel: remove threshold from should_be_closed_due_to_expiring_htlcs
The threshold was added a long time ago before we considered running electrum as a forwarding node.
(also, 500k sats are now worth 20x more in fiat terms, lol)
Against a forwarding node, it is actually exploitable.
2025-03-13 16:10:51 +00:00
SomberNight 8c320b4b5c lnchannel: add comment to extract_preimage_from_htlc_txin
ref https://github.com/spesmilo/electrum/issues/9631
2025-03-13 16:06:00 +00:00
ThomasV b64109ea88 swaps: set locktime to None instead of zero, so that anti fee-sniping works 2025-03-13 12:46:13 +01:00
f321x af8d1fb401 handle jit invoices in qml
make min funding amount symbol, change Signal name, change Exception type

change minChannelFunding to QEAmount and make message text variable

qml: improve translatibility of strings

init minchannelfunding value in init method

rebase on master
2025-03-13 12:02:46 +01:00
f321x 5134d07b14 add zeroconf handling to qt gui 2025-03-13 11:49:50 +01:00
f321x 7a6b4adca9 validate zeroconf channel once mined 2025-03-13 10:56:54 +01:00
ThomasV bdb7a82220 batch payment manager:
The class TxBatcher handles the creation, broadcast and replacement
of replaceable transactions. Callers (LNWatcher, SwapManager) use
methods add_payment_output and add_sweep_info. Transactions
created by TxBatcher may combine sweeps and outgoing payments.

Transactions created by TxBatcher will have their fee bumped
automatically (this was only the case for sweeps before).

TxBatcher manages several TxBatches. TxBatches are created
dynamically when needed.

The GUI does not touch txbatcher transactions:
  - wallet.get_candidates_for_batching excludes txbatcher
    transactions
  - RBF dialogs do not work with txbatcher transactions

wallet:
  - instead of reading config variables, make_unsigned_transaction
    takes new parameters: base_tx, send_change_to_lighting

tests:
  - unit tests in test_txbatcher.py (replaces test_sswaps.py)
  - force all regtests to use MPP, so that we sweep transactions
    with several HTLCs. This forces the payment manager to aggregate
    first-stage HTLC tx inputs. second-stage are not batched for now.
2025-03-13 10:17:10 +01:00
ThomasV e09676b26f swaps_dialog: fee_slider_callback should be called at the end of constructor 2025-03-13 08:47:30 +01:00