1
0
Commit Graph

18045 Commits

Author SHA1 Message Date
ThomasV
7eec7e6a20 increase sleep time in TestOnionMessageManager.test_forward
Co-authored-by: ghost43 <somber.night@protonmail.com>
2025-02-20 18:05:21 +01:00
accumulator
6996574c8e Update electrum/onion_message.py _get_request_for_path_id return type
Co-authored-by: ghost43 <somber.night@protonmail.com>
2025-02-20 17:17:14 +01:00
Sander van Grieken
ad6eb73dd3 onion_messages: guard onion message forwarding behind config option
EXPERIMENTAL_LN_FORWARD_PAYMENTS (default False)
2025-02-20 00:31:36 +01:00
Sander van Grieken
c3c5aaab3d onion_messages: add tests for forwards, receive unsolicited. 2025-02-19 17:43:36 +01:00
Sander van Grieken
0b86e39121 onion_messages: additional checks and comments;
- check on initial_node_id as the type can in theory contain a sciddir.
- log allowed_features if present in recipient_data, with an additional comment describing
the handling of allowed_features in the future.
- document the SHOULD constraint on onion_message payload size
2025-02-19 14:29:50 +01:00
Sander van Grieken
560b244b4d onion_messages: replace more hardcoded test vector values with symbols 2025-02-19 14:29:50 +01:00
Sander van Grieken
f9a374729e onion_messages: generalize List parameter typing to more abstract Sequence 2025-02-19 14:29:50 +01:00
Sander van Grieken
6e35ffe4b5 lnmsg: support both primitive and complex types (subtypes) in LNSerializer.
This renames lnmsg._{read,write}_field to lnmsg._{read,write}_primitive_field, renames
LNSerializer._{read,write}_complex_type to LNSerializer.{read,write}_field and allows
LNSerializer.{read,write}_field to handle both primitive and complex types.

Also makes these funcs public, as these encodings are used outside of lnmsg as well
(e.g. encoding blinded paths in BOLT12 invoice_request)
2025-02-19 14:29:50 +01:00
Sander van Grieken
e216f1b324 onion_messages: add parameter typing and comments 2025-02-19 14:29:50 +01:00
ThomasV
71b9761981 onion_messages_manager:
- use namedtuple instead of dict for pending messages
 - use asyncio.Future instead of event and result
2025-02-19 14:29:50 +01:00
ThomasV
d814796484 Deobfuscate names
The name 'requestreply' do not mean anything. If something can either
be a request or a reply, perhaps we can call it 'message', instead of
introducing a new name?

In general, coming up with new names comes at a cost, because you
are forcing other developers to learn and use your terminology.
Please minimize that.
2025-02-19 14:29:50 +01:00
ThomasV
aeaec452a0 Remove unnecessary events
We do not need asyncio Events in order to signal that a queue is
empty. Instead, we should use asyncio queues.
2025-02-19 14:29:34 +01:00
ThomasV
86432f55ee Remove redundant code: this line is duplicated 2 lines below 2025-02-19 14:29:34 +01:00
ThomasV
3314ee1de1 test_onion_messages: cleanup time constants, make speedup homogeneous.
1. Do not pass request_reply_timeout and request_reply_retry_delay
to OnionMessageManager.

Arguments passed to a function are useful only if their value might
change during the execution of a program. If that is not the case,
it is preferable to define them as constants. That makes the code
easier to read, because the reader can focus on arguments that are
actually relevant.

2 . Multiply all time constants by the same factor, instead
of doing so incompletely and on a per parameter basis. (note
that before this commit, the speedup factor was not consistent)

3. Do not use util.now(), because it is rounded as integer.

With these changes, the tests can effectively run with a 100x speedup
2025-02-19 14:29:34 +01:00
ThomasV
4efd4a0ff7 test_onion_message: enable logging so that we can see what is going on 2025-02-19 14:29:34 +01:00
ThomasV
a157108e75 onion_messages: fix code indentation 2025-02-19 14:29:34 +01:00
Sander van Grieken
7109c22317 unasync, no add_peer in create_onion_message_route_to, add manager tests 2025-02-19 14:29:34 +01:00
Sander van Grieken
7b4180202a add onion message support 2025-02-19 14:29:02 +01:00
Sander van Grieken
12ffbfc29e lnutil: add onion message feature flag 2025-02-19 14:28:11 +01:00
Sander van Grieken
7c8dfdecbb lnmsg: additional de/serialization support for onion messages
- add support for `subtype`/`subtypedata` type declarations
- add new primitive type `sciddir_or_pubkey`
- better assert message for cardinality errors
2025-02-19 14:27:47 +01:00
Sander van Grieken
00bba471ff onion_wire: use unqualified byte,... type for yet undefined nested tlv types 2025-02-19 14:27:45 +01:00
Sander van Grieken
dca6adcbf6 lnwire: add msg and tlv types for onion_message, including unknown_tags for test vectors 2025-02-19 14:27:36 +01:00
ThomasV
392c219913 simplify history-related commands:
- reduce number of methods
 - use nametuples instead of dicts
 - only two types: OnchainHistoryItem and LightningHistoryItem
 - channel open/closes are groups
 - move capital gains into separate RPC
2025-02-19 11:40:21 +01:00
SomberNight
ae8bfdcb51 qt: main_window: (trivial) fix typo on statusbar
a whitespace was missing
2025-02-18 15:36:27 +00:00
ghost43
3f9340270c Merge pull request #9568 from f321x/fix_node_ann_features
Ignore odd bits if even bit is set too in list_enabled_bits
2025-02-18 14:47:34 +00:00
f321x
9394b18b4e add method list_enabled_ln_feature_bits 2025-02-18 15:21:24 +01:00
ghost43
4f782fd687 Merge pull request #9566 from accumulator/lnworker_imports
lnworker: imports, whitespace
2025-02-17 15:01:31 +00:00
Sander van Grieken
c740057bc7 lnworker: imports, whitespace 2025-02-17 14:41:32 +01:00
ThomasV
18baf003d4 submarine swaps: backport changes from batch_payment_manager
- add 'is_funded' method to SwapData
 - sign claim transactions using the 'make_witness' method
2025-02-15 10:29:19 +01:00
SomberNight
2d8c26f211 qt swaps: fix _spend_max_reverse_swap: round down msats
Clicking "max" btn for a reverse swap was setting the text field to a too high value.

```
>>> wallet.lnworker.num_sats_can_send()
Decimal('1242647.947')
>>> util.format_satoshis_plain(Decimal('1242647.947'))
'0.01242648'
```
2025-02-14 14:33:51 +00:00
SomberNight
6749468866 swaps: add base class for transports. move "get_recent_offers" logic
the "get_recent_offers" logic is now shared between the GUIs
2025-02-14 14:10:24 +00:00
ThomasV
6ddd0b95ca workaround grouping bug with dummy values 2025-02-14 13:46:38 +01:00
ThomasV
5600e79edd fix swaps-over-nostr qml:
- post-rebase fixes
 - await sm.is_initalized.wait() instead of waiting 1 second
 - fix max_amount computation if channel recv capacity is higher
   than the max: the value returned by get_send_amount was zero
 - fix indentation
2025-02-14 10:57:01 +01:00
Sander van Grieken
993a575b7f submarine_swaps: implement swaps-over-nostr for qml 2025-02-14 09:54:09 +01:00
ThomasV
22995b4a34 follow-up 912e1a3a5b: password may be None if wallet is not file encrypted 2025-02-13 11:52:46 +01:00
ThomasV
c3faadf23f If a transaction uses make_witness, also set script_sig.
Other methods (remove_signatures) may have set script_sig to None
during the lifetime of the tx object.
2025-02-13 11:01:03 +01:00
ThomasV
b097150806 Merge pull request #9551 from f321x/swap_nostr_event_type
Change nostr swap event type, add PoW, rebroadcast events
2025-02-12 10:31:54 +01:00
f321x
a47421490d increase nonce size to 32 byte and make it hex in event 2025-02-12 10:09:11 +01:00
f321x
947094c1b0 add pow, more default relays, new event type 2025-02-11 18:16:15 +01:00
SomberNight
72c664856d qt gui: qrcodewidget: default size smaller for large codes
and use default sizing when displaying PSBTs.

Prior to this, when displaying a large PSBT (that should still fit within a QR),
the default window size was too small, and the user had to manually resize the window.
2025-02-10 18:32:09 +00:00
SomberNight
3de90952d1 tests: add a test for util.ShortID class 2025-02-10 16:36:19 +00:00
Sander van Grieken
36efae3875 imports, whitespace 2025-02-10 14:22:50 +01:00
accumulator
7e5ad079b2 Merge pull request #9534 from scgbckbone/fix_msg_sign
fix Coldcard msg signing for segwit v0 address types
2025-02-10 13:46:46 +01:00
accumulator
9cca92d837 Merge pull request #9523 from accumulator/qt_expired_invoice
qt: show warning on expired invoice on send tab.
2025-02-10 11:43:27 +01:00
Sander van Grieken
9b520d31ab qt: fix defer eval of maybe_master_pubkey in case of electrum seed with seed extension 2025-02-10 11:28:41 +01:00
Sander van Grieken
c2456892b4 qt: show warning on expired invoice on send tab.
Also disables Save button when invoice has expired.
2025-02-10 10:36:28 +01:00
SomberNight
5b2068976c config: remove a footgun 2025-02-07 16:22:44 +00:00
SomberNight
ac20422fb7 lnpeer: log their_features in INIT msg 2025-02-06 17:26:26 +00:00
scgbckbone
4f5a732fef fix Coldcard msg signing for segwit v0 address types 2025-02-06 16:41:17 +01:00
SomberNight
b55b8d183b ci: fix "regtest" task failing due to pip weirdness
pip was failing to install "electrum_aionostr>=0.0.7".
This was when using "python3-pip" from ubuntu 22.04 apt.

```
Discarding 95a16d58c8/electrum_aionostr-0.0.7.tar.gz (sha256)=e0b45d608977891c3bb4f6a4dee9a4e843fa661ceca31f81e7b992e65117070a (from https://pypi.org/simple/electrum-aionostr/) (requires-python:>=3.8): Requested unknown from 95a16d58c8/electrum_aionostr-0.0.7.tar.gz (sha256)=e0b45d608977891c3bb4f6a4dee9a4e843fa661ceca31f81e7b992e65117070a (from Electrum==4.5.8) has inconsistent name: filename has 'electrum-aionostr', but metadata has 'unknown'
```

Updating to newer pip directly using pip seems to fix this:
```
$ python3 -m pip install --user --upgrade pip
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (22.0.2)
Collecting pip
  Downloading pip-25.0-py3-none-any.whl (1.8 MB)
```
2025-02-05 13:23:42 +00:00