1
0
Commit Graph

24 Commits

Author SHA1 Message Date
ThomasV
fa575ab1fc fix test_onion_message (follow-up previous commit) 2026-01-13 17:36:06 +01:00
SomberNight
0afd433c42 tests: properly clean-up MockLNWallets after tests finish 2026-01-05 15:56:10 +00:00
SomberNight
17f41044d5 tests: lnpeer: fix cyclic lnworker.wallet.lnworker inconsistency
These better hold, lol:
wallet.lnworker.wallet == wallet
lnworker.wallet.lnworker == lnworker
2026-01-05 15:56:01 +00:00
SomberNight
17b7974800 tests: lnpeer: simplify tx_queue 2026-01-05 15:55:45 +00:00
SomberNight
1006e8092f lnworker: split LNWallet and LNWorker: LNWallet "has an" LNWorker
- LNWallet no longer "is-an" LNWorker, instead LNWallet "has-an" LNWorker
- the motivation is to make the unit tests nicer, and allow writing unit tests for more things
  - I hope this makes it possible to e.g. test lnsweep in the unit tests
  - some stuff we would previously have to write a regtest for, maybe we can write a unit test for, now
- in unit tests, MockLNWallet now
  - inherits LNWallet
  - the Wallet is no longer being mocked
2026-01-05 15:55:31 +00:00
SomberNight
08f101a7e5 tests: lnpeer/onion_msg: rm dead code 2025-12-19 14:53:28 +00:00
Sander van Grieken
23d5ed87e7 onion_message: move encrypt_onionmsg_tlv_hops_data() to lnonion as encrypt_hops_recipient_data()
and add support payloads other than onionmsg_tlv
2025-11-25 15:15:12 +01:00
SomberNight
4fedab8bba fix tests: follow-up prev 2025-11-21 18:16:59 +00:00
SomberNight
1b600b49e9 lnmsg/lnonion: follow-up prev: "hide" MappingProxyType usage 2025-11-18 14:54:33 +00:00
f321x
936e7fd1c2 lnonion: immutable OnionPacket and OnionHopsDataSingle
Make OnionHopsDataSingle and OnionPacket immutable for safer caching and
handling.

# Conflicts:
#	electrum/onion_message.py
2025-11-11 14:37:37 +01:00
Sander van Grieken
1ad6607405 onion_message: fix handling of ONION_MESSAGE_LARGE_SIZE payload sizes for onion messages,
process dummy hops regardless of EXPERIMENTAL_LN_FORWARD_PAYMENTS config option.
2025-11-10 16:20:15 +01:00
Sander van Grieken
9481f4f636 followup prev 2025-11-10 13:50:38 +01:00
Sander van Grieken
130af59760 update field naming for BOLT04 structures
see also: 3fffab3b88
2025-11-10 13:47:20 +01:00
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
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
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
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
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
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