Commit Graph

9057 Commits

Author SHA1 Message Date
SomberNight 8a3d9fd758 qml: FeePicker: restrict abs/rate editing to mimic wallet.bump_fee/cpfp 2026-01-14 16:53:30 +00:00
SomberNight 65f245f475 qml: FeePicker: hide "Target" line in "Manual" mode
instead use font colors to hint which textedit is being used for target
2026-01-12 18:42:14 +00:00
SomberNight f387300ab2 qml: FeePicker: use UI_UNIT_NAME constants, instead of hardcoding 2026-01-12 18:41:52 +00:00
Sander van Grieken fffcf4a90b qml: add FeePicker manual fee/feerate input validators 2025-12-18 08:32:46 +01:00
Sander van Grieken 7ef605ee5c qml: allow manual editing of fee/feerate
also improve warning box styling consistency across finalizers,
add CPFP new feerate > old feerate check,
add relayfee checks for CPFP, DSCancel,
proper warning string for no dynamic fee estimates
2025-12-18 08:32:46 +01:00
Sander van Grieken 4cab0ceddd qml: don't catch-all when making tx for sweep finalizer 2025-12-18 08:31:09 +01:00
ghost43 308ffb1f4c Merge pull request #10318 from SomberNight/202511_lnsweep_keepwatching
lnsweep: lnwatcher needs to keep_waiting for pending hold_invoice
2025-12-18 00:54:14 +00:00
Sander van Grieken 5a49161ae6 qml: fix FeePolicy regression
ref 840243e029
2025-12-17 15:50:04 +01:00
SomberNight f339a6b76d lnwatcher: follow-up prev 2025-12-17 10:23:16 +00:00
f321x a105c50029 qt: trustedcoin: only allow signing with broadcast
Only allow signing a transaction if it also gets broadcast by disabling
the signing and broadcast button of the preview dialog when creating a
new tx. Makes it slightly less trivial to cheat with the fees.
2025-12-16 13:54:08 +01:00
SomberNight 7e1fd008f0 lnsweep: lnwatcher needs to keep_watching if htlc in dont_settle_htlcs
If RHASH is in lnworker.dont_settle_htlcs, we should not reveal
the preimage. But also, we should not disregard the htlc either.

E.g. during a JIT channel open, payment going A->B->C,
C would release the preimage to B (lsp) to cover the costs of the
JIT channel-open. If the upstream A->B channel gets force-closed, B should
only pull the HTLC's funds if he is sure he can forward them to C.

lnwatcher needs to keep watching (i.e. wait) until the RHASH gets removed from
lnworker.dont_settle_htlcs, or until the CLTV of the HTLC expires.
2025-12-15 14:53:50 +00:00
f321x 095debcded plugin: timelock recovery: more i18n 2025-12-15 11:52:57 +01:00
ThomasV bd735c645d Merge pull request #10359 from f321x/lnpeer_remove_zlib_compression
lnpeer: remove zlib encoding support from gossip
2025-12-13 11:18:22 +01:00
ThomasV 1d98d08f5b Merge pull request #10360 from f321x/qt_fix_lightning_icon_gossip_sync
qt: make ElectrumWindow.lightning_button wider
2025-12-13 11:15:51 +01:00
f321x 2f2340d69f lnworker: prevent creation of PaymentInfo with 0 exp
In some parts of the application 0 (sec) == no expiry, however we
use `LN_EXPIRY_NEVER` (100 years) instead of 0 for lightning invoices.

This replaces a 0 second expiry with `LN_EXPIRY_NEVER` in
`LNWallet.create_payment_info()` to prevent htlcs for no-expiry invoices
from getting failed incorrectly (which the assert prevented)
and fix the assertion error in #10350.

Fixes #10350.

# Conflicts:
#	electrum/lnworker.py
2025-12-12 09:58:22 +01:00
f321x 7ccf118755 qt: make ElectrumWindow.lightning_button wider
Qt was showing the lightning_button percentage string while syncing gossip
as `...` instead of the percentage as the minimum width of the button
seemed too small. Increasing this a bit fixes the issue.
2025-12-12 09:50:26 +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
ghost43 783cd56046 Merge pull request #10356 from f321x/remove_newline_rawtx
tx: replace all whitespace chars in raw tx (convert_raw_tx_to_hex)
2025-12-11 18:49:13 +00:00
SomberNight 37db6ea7e8 transaction: tx_from_any: rm all whitespaces from str, none from bytes
- whitespaces are safe to remove from strings, and is convenient if we do this for users
- bytes-like inputs should be left alone: individual bytes that look like whitespaces can appear in them anywhere
  - even stripping the leading/trailing whitespaces is not safe to do: the first byte of the nVersion or the last byte of the nLocktime might look like whitespace too!
- instead, leading/trailing whitespaces can be stripped closer to where they are input, e.g. in the GUI
  - e.g. ".txn" files that we ourselves create contain a complete tx as a hex string, with a trailing final newline in the file
    - instead of reading that as bytes, we can read it as text
  - ".psbt" files OTOH are binary
2025-12-11 16:48:50 +00:00
SomberNight 16363cc3d9 transaction: tx_from_any: follow-up: only rm whitespaces from strings 2025-12-11 16:24:31 +00:00
SomberNight 9af0195f60 transaction: psbt.from_raw_psbt: clarify hex input must be str
no functional change (besides incorrect input now raising a different exception)

```
>>> bytes.fromhex(b"deadbeef")
TypeError: fromhex() argument must be str, not bytes
```
2025-12-11 15:23:33 +00:00
f321x 1ebb937d46 lnpeer: decode_short_ids: check length of short ids
- if `encoded_short_ids` does not decode into a whole number of `short_channel_id`:
  - MAY send a `warning`.
  - MAY close the connection.
https://github.com/lightning/bolts/blob/0cf21511a781c295b9374aeaef37cf9c4d193502/07-routing-gossip.md?plain=1#L674

# Conflicts:
#	electrum/lnpeer.py
2025-12-11 15:44:11 +01:00
f321x 380d7edea2 lnpeer: remove support for zlib compression
Must not be used anymore according to bolt 7:
https://github.com/lightning/bolts/blob/0cf21511a781c295b9374aeaef37cf9c4d193502/07-routing-gossip.md?plain=1#L600
2025-12-11 15:43:45 +01:00
f321x 7d307048a0 tx: replace whitespace chars in raw tx string
Removes all whitespace characters from a raw transaction string.
This is useful for example when loading raw transactions from text input
as it happens that there are some newline characters in the text.
I noticed this when copying-pasting from a timelock recovery pdf.
2025-12-11 10:34:49 +01:00
ghost43 0eefcbae9c Merge pull request #10357 from f321x/fix_ledger_exception
wizard: hw: handle UserFacingException during encryption step
2025-12-10 17:04:59 +00:00
ghost43 20db0d2311 Merge pull request #10358 from SomberNight/202512_lnworker_get_chan_by_id
lnworker/lnpeer: don't use lnworker.channels.get(chan_id)
2025-12-10 16:47:04 +00:00
f321x 4712417969 wizard: handle UserFacingException in WCWalletPasswordHardware
Handles `UserFacingException` in the `WCWalletPasswordHardware` step of
the hardware wallet wizard flow. This fixes the previous FIXME and
prevents the crash reporter from getting triggered if the the user e.g.
disconnects his hardware wallet during the wallet encryption step.
2025-12-10 17:45:15 +01:00
ghost43 4d39a198cc Merge pull request #10353 from f321x/lnurlw_exc
lnurlw: catch UserCancelled and handle 'null' minWithdrawable
2025-12-10 16:21:45 +00:00
SomberNight c465f7c3e0 lnworker/lnpeer: don't use lnworker.channels.get(chan_id)
- lnworker.channels takes a copy of the whole dict, to make it thread-safe
- in LNWallet class, can just use self._channels.get(chan_id)
- otherwise there is lnworker.get_channel_by_id
- same for lnpeer.channels.get and lnpeer.get_channel_by_id
2025-12-10 16:14:31 +00:00
ghost43 6ceb4ad71f Merge pull request #10351 from f321x/jit_htlc_switch_fixes
lnpeer/lnutil: fail mpp if we didn't signal mpp in invoice
2025-12-10 15:56:23 +00:00
SomberNight 745318d1ec wallet_db: convert_version_66: trivial simplification 2025-12-10 15:53:17 +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
f321x c34efce984 lnchannel: allow deleting unfunded incoming channels
We tried to delete incoming channels that didn't get funded after
lnutil.CHANNEL_OPENING_TIMEOUT, however an assert prevented this:

```
  3.63 | E | lnwatcher.LNWatcher.[default_wallet-LNW] | Exception in check_onchain_situation: AssertionError()
Traceback (most recent call last):
  File "/home/user/code/electrum-fork/electrum/util.py", line 1233, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/code/electrum-fork/electrum/lnwatcher.py", line 117, in check_onchain_situation
    await self.update_channel_state(
    ...<5 lines>...
        keep_watching=keep_watching)
  File "/home/user/code/electrum-fork/electrum/lnwatcher.py", line 135, in update_channel_state
    chan.update_onchain_state(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        funding_txid=funding_txid,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        closing_height=closing_height,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        keep_watching=keep_watching)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/code/electrum-fork/electrum/lnchannel.py", line 341, in update_onchain_state
    self.update_unfunded_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/user/code/electrum-fork/electrum/lnchannel.py", line 382, in update_unfunded_state
    self.lnworker.remove_channel(self.channel_id)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/user/code/electrum-fork/electrum/lnworker.py", line 3244, in remove_channel
    assert chan.can_be_deleted()
           ~~~~~~~~~~~~~~~~~~~^^
AssertionError
```
2025-12-10 13:20:32 +01:00
f321x e1f1e6f788 qt: lnurlw: catch UserCancelled on lnurlw withdrawal
Catch the UserCancelled exception if the user cancels the lnurlw
coroutine dialog during the withdrawal.
2025-12-10 10:55:16 +01:00
f321x 4bd013ef10 lnurlw: accept "null" minWithdrawable in response
Accept a `null` value as response for the `minWithdrawable` field in the
lnurlw response. Some servers seem to set this to `null` instead of 0
when having no minimum withdrawal amount.
2025-12-10 10:50:01 +01:00
f321x 183d426e93 lnpeer: fail htlcs if we get unwanted mpp
Fail incoming htlcs if we receive a payment consisting of multiple parts
if we signaled to not want mpp in the invoice.
2025-12-10 10:36:39 +01:00
f321x 125a921cc4 lnworker: add invoice features to PaymentInfo class
Adds the invoice features to the `PaymentInfo` class so we can check if
the sender respects our requested features (e.g. if they tried to send
mpp if we requested no mpp).
2025-12-10 10:36:31 +01:00
f321x 5be598b808 lnworker: use channel_id instead of scid in ReceivedMPPHtlc
Store the channel id instead of the scid in ReceivedMPPHtlc.
The scid can be None, in theory even for multiple channels at the same
time. Using the channel_id which is always available and unique seems
less error prone at the cost of temporarily higher storage requirements
in the db for the duration of the pending htlcs.

Alternatively we could use the local scid alias however using the
channel_id seems less complex and leaves less room for ambiguity.
2025-12-09 14:44:11 +01:00
f321x 8a88ebe6bc lnworker: add type assert to get_channel_by_short_id
Prevents accidentally passing None if channel.short_id is not set yet
2025-12-09 14:44:09 +01:00
SomberNight 6d1e8e8619 lnworker: write rationale for PaymentInfo class in docstring
ref https://github.com/spesmilo/electrum/commit/4ad9caddab3fe5d3b25fc53d7ffa7ccf5cbd3b6c
ref https://github.com/spesmilo/electrum/commit/f08e5541aeda9524eb456477f93732de7357c792
2025-12-08 15:54:37 +00:00
ThomasV da998150ac lnpeer: deduct JIT fees also for trampoline 2025-12-06 10:33:24 +01:00
f321x fb566eb59e lnpeer: deduct jit channel fees from total amount
Deduct the just in time channel opening fees from the total amount so
htlcs don't get timed out if they come from a just in time channel with
opening fee.

Related: https://github.com/spesmilo/electrum/pull/9584
2025-12-06 10:14:07 +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
ghost43 07b59631bf Merge pull request #10349 from SomberNight/202512_openalias
openalias: always require DNSSEC validation, and fix a qml regression
2025-12-05 17:09:19 +00:00
SomberNight cf8c243bd9 dnssec: log warning if dependency is missing
Calling dnssec.query() with missing "cryptography" dep behaves the same as if DNSSEC validation failed: validated=False will be returned.
When used for openalias, we mandate validated=True.
2025-12-05 17:06:50 +00:00
SomberNight cdcac8cb09 openalias: always enforce DNSSEC validation succeeds 2025-12-05 17:06:41 +00:00
Sander van Grieken 23b6465780 onion_message: verify ONION_MESSAGE feature on peer before forwarding 2025-12-05 17:53:03 +01:00
Sander van Grieken fb58d210e5 onion_message: fix forwarding, blinding was renamed path_key
followup 130af59760
2025-12-05 17:51:19 +01:00
SomberNight 49430e9722 qml: fix: paying to openalias
regression from in https://github.com/spesmilo/electrum/pull/9993
    7d0ac64d06
2025-12-05 16:12:04 +00:00
Sander van Grieken 3e4f80aa06 electrum refuses to exchange gossip with CLN nodes, due to missing feature OPTION_CHANNEL_TYPE_OPT.
moving OPTIONAL_CHANNEL_TYPE_OPT to BASE_FEATURES
2025-12-05 15:51:16 +01:00