Commit graph

6725 commits

Author SHA1 Message Date
Jeffrey Czyz
b578363248
Have TestRouter wrap DefaultRouter
TestRouter checks route and scoring expectations before delegating to
the standalone find_route function. Refactor it to wrap DefaultRouter
and delegate to it instead. This allows TestRouter to implement
create_blinded_payment_paths by delegating to DefaultRouter.
2024-01-16 11:12:34 -06:00
Jeffrey Czyz
3b6d039f89
Support OnionMessenger in functional_test_utils
OnionMessenger is needed to write functional tests for ChannelManager's
OffersMessageHandler implementation. Also adds a TestMessageRouter,
which simply wraps DefaultMessageRouter for now.
2024-01-16 11:12:20 -06:00
Jeffrey Czyz
8deac898ab
DRY up EntropySource implementation
The ChaCha20-based EntropySource implementation is duplicated within the
sign module. Refactor those into a RandomBytes implementation so that it
may be reused both there. Also useful as a standalone EntropySource
implementation for tests where an independent EntropySource is needed to
ensure that backwards-compatibility testing is not broken.
2024-01-15 20:12:37 -06:00
Jeffrey Czyz
911ed6dafc
Fix import order in functional_test_utils.rs 2024-01-15 20:12:36 -06:00
Jeffrey Czyz
ec8c6fb2a9
Add peel_onion_message method to OnionMessenger
When testing OnionMessenger in functional tests, it would be useful to
examine the contents of an OnionMessage response. Expose the standalone
peel_onion_message on OnionMessenger to facilitate this.
2024-01-15 20:12:36 -06:00
Elias Rohrer
ea5de93dd9
Merge pull request #2824 from shuoer86/main
Fix typos
2024-01-15 10:38:03 +01:00
shuoer86
fff6616b7c
Fix typo lightning/src/util/wakers.rs 2024-01-12 20:46:47 +08:00
shuoer86
9c22a48a49
Fix typo lightning/src/routing/router.rs 2024-01-12 20:46:40 +08:00
shuoer86
896477d33d
Fix typo lightning/src/ln/peer_handler.rs 2024-01-12 20:46:33 +08:00
shuoer86
8cd48060d7
Fix typo lightning-invoice/src/ser.rs 2024-01-12 20:46:26 +08:00
shuoer86
9c5edad51b
Fix typo CONTRIBUTING.md 2024-01-12 20:46:16 +08:00
Matt Corallo
4b70921c95
Merge pull request #2800 from optout21/channel-close-add-funding
Add channel funding txo to Channel Event::ChannelClosed
2024-01-11 19:35:26 +00:00
Elias Rohrer
cd5f09b8e3
Merge pull request #2822 from TheBlueMatt/2024-01-pm-dyn-ref
Drop `PeerManager` type bound on `UtxoLookup` entirely
2024-01-11 18:41:01 +01:00
Valentine Wallace
f09ac1931f
Make BlindedFailure enum pub.
Necessary to include it in the public PendingHTLCInfo struct in the next commit.
2024-01-11 11:36:28 -05:00
Valentine Wallace
8ad292eea6
Test successful payment to 3-hop blinded path. 2024-01-11 11:36:28 -05:00
Valentine Wallace
f1e4645edf
Fix final blinded hop CLTV expiry on send.
Previously, we were setting the final blinded hop's CLTV expiry height to
best_block_height + total_blinded_path_cltv_delta + shadow_cltv_offset. This is
incorrect, it should instead be set to best_block_height + shadow_cltv_offset
only -- it doesn't make sense to include the delta for the other blinded hops
in the final hop's expiry.

The reason this too-high final cltv value didn't cause test failures previously
is because of a 2nd bug that is fixed in an upcoming commit where the sender
adds the shadow offset twice to the total path CLTV expiry. This 2nd offset
meant that intermediate nodes had some buffer CLTV to subtract their delta from
while still (usually) have enough leftover to meet the expiry in the final hop's
onion.
2024-01-11 11:36:08 -05:00
Valentine Wallace
4a0170a941
Support forwarding blinded HTLCs as non-intro node.
Error handling will be completed in upcoming commit(s).
2024-01-11 11:33:33 -05:00
valentinewallace
62d52c6020
Merge pull request #2801 from valentinewallace/2023-12-rb-groundwork-followups
#2128 follow-ups
2024-01-11 11:30:46 -05:00
valentinewallace
3eec5d3c17
Merge pull request #2820 from TheBlueMatt/2024-01-fuzz-ooo-monitor-updates
Test individual monitor update compl in chanmon_consistency fuzzer
2024-01-11 11:22:34 -05:00
valentinewallace
9d803a92bd
Merge pull request #2821 from TheBlueMatt/2024-01-om-direct-export
Expose `onion_message` items directly rather than via re-exports
2024-01-11 09:52:00 -05:00
optout
efaba118da
Add channel funding txo to Channel Event::ChannelClosed 2024-01-11 09:15:53 +01:00
Wilmer Paulino
e82dba5e94
Assert we never write channels in pre-funded/shutdown state 2024-01-10 18:29:01 -08:00
Wilmer Paulino
4ac2a04ec8
Check funding transaction on outbound channels only
This was a slight regression, but not a critical one. Only outbound
channels should have a funding transaction present.
2024-01-10 18:29:00 -08:00
Wilmer Paulino
12f06c3fff
Simplify ChannelState checks 2024-01-10 18:29:00 -08:00
Wilmer Paulino
178c9ee45b
Rename should_force_holding_cell to can_generate_new_commitment
This better reflects the intent behind the callsites of the method.
2024-01-10 18:28:59 -08:00
Wilmer Paulino
a6572442df
Add note and test regarding ChannelState's implicit ordering 2024-01-10 18:28:56 -08:00
Matt Corallo
db81c650ba
Merge pull request #2791 from valentinewallace/2023-12-multihop-recv-followups
Follow-ups to #2688
2024-01-11 00:04:39 +00:00
Matt Corallo
ab66143cb6 Expose onion_message items directly rather than via re-exports
When we originally added the `onion_message` module, there weren't
a lot of public items in it, and it didn't make a lot of sense to
export the whole sub-module structure publicly. So, instead, we
exported the public items via re-exports directly in the
`onion_message` top-level module. However, as time went on, more
and more things entered the module, which left the top-level module
rather cluttered.

Worse, in 0.0.119, we exposed
`onion_message::messenger::SendSuccess` via the return type of
`send_message`, but forgot to re-export the enum itself, making
it impossible to actually use from external code.

Here we address both issues and simply replace the re-export with
the underlying sub-module structure.
2024-01-10 23:50:34 +00:00
Matt Corallo
ccf710d860
Merge pull request #2809 from TheBlueMatt/2023-12-closing-event-cleanup-fixes
Clean Up Funding Error Handling and shutdown
2024-01-10 22:37:07 +00:00
Matt Corallo
370339919d Drop PeerManager type bound on UtxoLookup entirely
In 67659677d4 we relaxed the bounds
set on `UtxoLookup` to enable those using `RoutingMessageHandler`
other than `P2PGossipSync` to use `UtxoLookup`. Sadly, because this
requires having a concrete `PeerManager` type which does *not* use
`UtxoLookup` in the `RoutingMessageHandler` type, this broke users
who were directly using `P2PGossipSync`.

We could split `UtxoLookup` into two, with different bounds, for
the two use-cases, but instead here we simply switch to storing a
reference to the `PeerManager` via a `dyn Fn` which allows us to
wake the `PeerManager` when we need to.

Fixes #2813
2024-01-10 22:33:43 +00:00
Valentine Wallace
3ec4d52277
Rename parameter from err_packet to err_contents.
This name is more accurate since the method has been generalized to support
malformed HTLCs.
2024-01-10 11:23:44 -05:00
Valentine Wallace
c1fbb90847
Remove outdated comment. 2024-01-10 11:23:44 -05:00
Valentine Wallace
95b3ef4910
Normalize order of (sha256_of_onion, failure_code) in trait.
This helps avoid destructuring the tuple.
2024-01-10 11:23:44 -05:00
Valentine Wallace
04e70bad0a
DRY malformed HTLC handling during htlc batch processing. 2024-01-10 11:23:44 -05:00
Valentine Wallace
5c880a0549
Fix logger usage during batched htlc processing of malforms.
Introduced due to a rebase error.
2024-01-10 11:23:44 -05:00
Valentine Wallace
d0d1634d95
Clean up code DRY'd in previous commit. 2024-01-10 11:19:09 -05:00
Valentine Wallace
b20a9ad270
Rename OutboundOnionPayload::BlindedReceive::amt_msat to be more descriptive. 2024-01-10 10:56:24 -05:00
Valentine Wallace
c76d74a4c1
Rename OutboundOnionPayload::Receive::amt_msat to be more descriptive. 2024-01-10 10:56:24 -05:00
Valentine Wallace
2b1c994512
Rename InboundOnionPayload::BlindedReceive::amt_msat to be more descriptive. 2024-01-10 10:56:24 -05:00
Valentine Wallace
2d58297b40
Rename InboundOnionPayload::Receive::amt_msat to be more descriptive. 2024-01-10 10:56:24 -05:00
Valentine Wallace
aace2d3e24
Rename OutboundOnionPayload::BlindedReceive::outgoing_cltv_value.
There is no outgoing HTLC for received HTLCs, so rename to be more accurate.
2024-01-10 10:56:24 -05:00
Valentine Wallace
4d38ee65c3
Rename OutboundOnionPayload::Receive::outgoing_cltv_value.
There is no outgoing HTLC for received HTLCs, so rename to be more accurate.
2024-01-10 10:56:24 -05:00
Valentine Wallace
7c3ef195c4
Rename InboundOnionPayload::BlindedReceive::outgoing_cltv_value.
There is no outgoing HTLC for received HTLCs, so rename to be more accurate.
2024-01-10 10:56:24 -05:00
Valentine Wallace
b8fa547c66
Rename InboundOnionPayload::Receive::outgoing_cltv_value
.. since there is no outgoing cltv for received HTLCs.
2024-01-10 10:56:24 -05:00
Valentine Wallace
cadea5dae5
Rename outgoing_cltv_value internal var.
There is no outgoing CLTV for received HTLCs, so this new var makes more sense.
2024-01-10 10:56:24 -05:00
Valentine Wallace
95a5ab96fc
Rename InboundOnionErr to InboundHTLCErr.
The prior name seems to reference onion decode errors specifically, when in
fact the error contents are generic failure codes for any error that occurs
during HTLC receipt.
2024-01-10 10:56:21 -05:00
Valentine Wallace
be134d11c9
Remove trailing whitespace. 2024-01-10 10:56:10 -05:00
Matt Corallo
f352d03ee9
Merge pull request #2748 from TheBlueMatt/2023-11-2675-followups
Doc and style followups from #2675
2024-01-09 23:22:48 +00:00
Matt Corallo
3b6d6937bb Update docs on HTLC and DelayedPayment keys for clarity
This also adds required linebreaks to keep the docs to a reasonable
width.
2024-01-09 22:24:59 +00:00
Matt Corallo
c5e3f5fa82 Drop the unused PaymentKey type
935a716cc6 added new wrappers for the
various channel keys, including a payment_key. However, the
`payment_key` has been unused in lightning since the introduction
(and broad requiring) of the `static_remotekey` feature.

Thus, we simply remove it (and an incredibly stale TODO) here.
2024-01-09 22:24:59 +00:00