Commit Graph

8098 Commits

Author SHA1 Message Date
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
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
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
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
ThomasV
307f5d301e Merge pull request #9693 from f321x/psbt_nostr_ephemeral_event
psbt plugin: add expiration tag to psbt nostr event and use ssl context
2025-04-03 14:28:22 +02:00
f321x
b8d10df2dc add expiration tag to psbt nostr event and pass ssl context to relay manager 2025-04-03 13:56:29 +02:00
ThomasV
cb75f21f3b Merge pull request #9640 from f321x/swap_dm_relays
swaps: Update submarine swap nostr relays dynamically and remove redundant query
2025-04-03 13:34:54 +02:00
Sander van Grieken
1ac885ea40 qml: add android permission methods in AppController 2025-04-03 12:37:17 +02:00
SomberNight
5c233ac325 ci: enable more flake8 stuff
```
$ export ELECTRUM_LINTERS=E9,E101,E129,E273,E274,E703,E71,E722,F5,F6,F7,F8,W191,W29,B
$ export ELECTRUM_LINTERS_IGNORE=B007,B009,B010,B019,B036,F541,F841
$ flake8 . --count --select="$ELECTRUM_LINTERS" --ignore="$ELECTRUM_LINTERS_IGNORE" --show-source --statistics --exclude "*_pb2.py,electrum/_vendor/"
./electrum/commands.py:98:1: F811 redefinition of unused 'format_satoshis' from line 48
def format_satoshis(x):
^
./electrum/commands.py:437:9: F811 redefinition of unused 'Mnemonic' from line 62
        from .mnemonic import Mnemonic
        ^
./electrum/gui/qt/wizard/wallet.py:37:5: F811 redefinition of unused 'Daemon' from line 14
    from electrum.daemon import Daemon
    ^
./electrum/lntransport.py:14:1: F811 redefinition of unused 'Optional' from line 12
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
^
./electrum/lntransport.py:14:1: F811 redefinition of unused 'TYPE_CHECKING' from line 12
from typing import NamedTuple, List, Tuple, Mapping, Optional, TYPE_CHECKING, Union, Dict, Set, Sequence
^
./electrum/plugin.py:966:13: F811 redefinition of unused 'hid' from line 593
            import hid
            ^
./electrum/plugin.py:1040:13: F811 redefinition of unused 'hid' from line 593
            import hid
            ^
./electrum/util.py:44:1: F811 redefinition of unused 'json' from line 26
import json
^
./electrum/util.py:46:1: F811 redefinition of unused 'NamedTuple' from line 29
from typing import NamedTuple, Optional
^
./electrum/util.py:46:1: F811 redefinition of unused 'Optional' from line 29
from typing import NamedTuple, Optional
^
./electrum/util.py:1456:56: F811 redefinition of unused 'traceback' from line 34
        async def __aexit__(self, exc_type, exc_value, traceback):
                                                       ^
./electrum/wallet_db.py:536:9: F811 redefinition of unused 'LOCAL' from line 46
        LOCAL = 1
        ^
./electrum/wallet_db.py:537:9: F811 redefinition of unused 'REMOTE' from line 46
        REMOTE = -1
        ^
./tests/test_bitcoin.py:28:1: F811 redefinition of unused 'bitcoin' from line 9
from electrum import crypto, constants, bitcoin
^
./tests/test_txbatcher.py:11:1: F811 redefinition of unused 'Transaction' from line 7
from electrum.transaction import Transaction, PartialTxInput, PartialTxOutput, TxOutpoint
^
./tests/test_wallet_vertical.py:20:1: F811 redefinition of unused 'Transaction' from line 10
from electrum.transaction import Transaction, PartialTxOutput, tx_from_any, Sighash
^
16    F811 redefinition of unused 'format_satoshis' from line 48
16

```
2025-04-02 16:21:59 +00:00
SomberNight
55281295b7 ci: bump flake8 to new version
```
./electrum/commands.py:144:9: F824 `global known_commands` is unused: name is never assigned in scope
        global known_commands
        ^
./electrum/commands.py:1916:9: F824 `global known_commands` is unused: name is never assigned in scope
        global known_commands
        ^
./electrum/gui/qt/main_window.py:2405:13: F824 `nonlocal done` is unused: name is never assigned in scope
            nonlocal done
            ^
./electrum/i18n.py:52:5: F824 `global language` is unused: name is never assigned in scope
    global language
    ^
./electrum/plugin.py:189:9: F824 `global _root_permission_cache` is unused: name is never assigned in scope
        global _root_permission_cache
        ^
5     F824 `global known_commands` is unused: name is never assigned in scope
5

```
2025-04-02 14:56:53 +00:00
ThomasV
651e081b2f Merge pull request #9671 from accumulator/fix_lightning_can_receive_offline_peer
lnworker: take peer_state into account in get_channels_for_receiving
2025-04-02 14:33:45 +02:00
ghost43
bbea6223f1 Merge pull request #9692 from f321x/fix_channel_freezing
lightning: don't use frozen channels from route hint
2025-04-02 12:28:15 +00:00
f321x
964ffbd2c4 don't use route hint channels if they are frozen 2025-04-02 13:48:46 +02:00
Sander van Grieken
08e2970889 lnworker: add parameter include_disconnected for get_channels_for_receiving(),
allowing less strict filtering when building route hints (i.e. likely usable soon-ish)
2025-04-02 11:35:47 +02:00
ThomasV
ff3e70d743 psbt_nostr: fix for watch-only wallets 2025-04-02 11:31:08 +02:00
SomberNight
2807be08c8 tests/test_txbatcher.py: de-duplicate "create wallet" logic 2025-04-01 15:00:23 +00:00
ghost43
664c4b25d1 Merge pull request #9689 from f321x/ln_disable_fallback_fee
lightning: don't use fallback feerates for lightning fee estimation
2025-04-01 12:20:32 +00:00
f321x
0b19b660c5 don't use fallback feerates in lightning by default 2025-04-01 14:12:02 +02:00
Sander van Grieken
1559129016 qml: properly destroy ExceptionDialog after close, improve encapsulation 2025-03-28 14:51:12 +01:00
Sander van Grieken
1d07895e8c qml: fix #9677 2025-03-27 19:16:29 +01:00
accumulator
bf317af30b Merge pull request #9672 from accumulator/qt_swaps_handle_usercancelled
qt: handle UserCancelled when initializing swapmanager and requesting…
2025-03-27 13:30:49 +01:00
accumulator
542897d067 Merge pull request #9668 from accumulator/qml_txdialog_sane_values
qml: ConfirmTxDialog: when finalizer is invalid, don't show input/out…
2025-03-27 12:44:49 +01:00
accumulator
8d044d43e0 Merge pull request #9661 from accumulator/qml_feebump_cancel_txmon_fixes
qml: detect transaction removed (e.g. replace-by-fee) for qetxdetails and qetxfinalizer
2025-03-26 14:41:05 +01:00
Sander van Grieken
9be6d6e732 small fixes, imports, whitespace 2025-03-25 16:50:37 +01:00
Sander van Grieken
f7c1b203b2 qt: handle UserCancelled when initializing swapmanager and requesting swap invoice
when sending change to lightning
2025-03-25 11:48:24 +01:00
accumulator
67171af4a5 Merge pull request #9663 from accumulator/qml_swap_success_popup
qml: swap: don't show long swap success message in info box, show in popup instead and close swap dialog after accept.
2025-03-24 19:59:41 +01:00
Sander van Grieken
2de11eac92 qml: ConfirmTxDialog: when finalizer is invalid, don't show input/outputs,
show requested amount instead of effectiveamount
2025-03-24 14:36:56 +01:00
Sander van Grieken
d0ecf634c8 qml: auto close invoicedialog after successful onchain tx broadcast 2025-03-24 12:10:41 +01:00
ThomasV
1aa066ea19 wallet.py: rm unused imports 2025-03-22 13:54:29 +01:00
ThomasV
6e92a00ec4 Remove zeroconf option for submarine swaps
Since we now accept random swap providers, it is unreasonable
to keep that option.
2025-03-21 18:18:27 +01:00
Sander van Grieken
4494c3e2b5 qml: swap: don't show long swap success message in info box, show in popup instead
and close swap dialog after accept.
2025-03-21 18:16:57 +01:00
Sander van Grieken
f16efd759a qml: detect transaction removed (e.g. replace-by-fee) for qetxdetails and qetxfinalizer,
don't close active feebump/cancel dialogs, but invalidate them,
don't close TxDetails page, but show removed status,
show broadcast-failed status in TxDetails
2025-03-21 17:36:17 +01:00
Sander van Grieken
3db26c4ecb qml: correctly update mining fee for reverse swaps and inhibit delayed fwd swap ui update
when slider is on reverse swap side.
2025-03-21 16:32:13 +01:00
ThomasV
45b5bdca48 wallet: can_sign should return False for a swap claim tx, because it is handled by txbatcher 2025-03-21 16:31:11 +01:00
Sander van Grieken
91a72646ba qml: fix Open Channel button enable when amount changes 2025-03-21 15:49:34 +01:00
ThomasV
95a8959714 qt: add swap button to balance window 2025-03-21 14:09:11 +01:00
ThomasV
4aed77d101 qt: show error if we cannot contact swapserver while using http 2025-03-21 14:07:49 +01:00
f321x
21e3fd91dd dynamically update relays and remove redundant nostr query, store last
swapserver relays in file
2025-03-21 09:31:50 +01:00
SomberNight
937b157d29 qt: main_window: fix init_geometry
probably regression from qt6 migration

Don't use broad generic "except Exception" without at least logging the exception, please...
That's why this was not noticed before, the exception was being swallowed.

Nevertheless, on Linux with wayland, this still does not work (the geometry API is getting dumb values).
On x11 it now works again, as well as on Windows. (haven't tested macos)

```
  7.78 | I | gui.qt.main_window.[9dk] | using default geometry
Traceback (most recent call last):
  File "...\electrum\electrum\gui\qt\main_window.py", line 538, in init_geometry
    screen = self.app.desktop().screenGeometry()
AttributeError: 'QElectrumApplication' object has no attribute 'desktop'
```
2025-03-20 19:10:28 +00:00