Commit Graph

46 Commits

Author SHA1 Message Date
MPins
c84804f81f itest: add the test for incoming channel list on blinded invoice 2025-05-13 17:02:44 -03:00
Elle Mouton
b13f22be6b itest: remove manual channel closures from route blinding tests
The itest framework now handles the closure of any channels opened
during the test and so we dont need to manually close them. The manual
closure code in the route blinding tests were resulting in the
occasional test flake.
2025-04-14 17:11:24 +02:00
yyforyongyu
d122a2ecc6 itest+lntest: add flakePaymentStreamReturnEarly
Fix the flake found in the `testRelayingBlindedError` and documents the
flake found in other tests in one place.
2025-03-18 20:24:34 +08:00
yyforyongyu
a067aa45ef itest: add flakeInconsistentHTLCView 2025-03-18 20:24:33 +08:00
yyforyongyu
2d5a2ce78a lntest+itest: change the method signature of AssertPaymentStatus
So this can be used in other tests when we only care about the payment
hash.
2025-02-28 19:07:38 +08:00
Nishant Bansal
23efbef946 itest: update tests with timeout_seconds
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-01-15 19:46:09 +05:30
yyforyongyu
e79ad6e5aa itest: further reduce block mined in tests 2024-12-20 19:38:12 +08:00
yyforyongyu
7ceb9a4af5 lntest+itest: remove AssertNumActiveEdges
This is no longer needed since we don't have standby nodes, plus it's
causing panic in windows build due to `edge.Policy` being nil.
2024-12-20 19:38:08 +08:00
yyforyongyu
72f3f41d41 itest: remove unnecessary channel close and node shutdown
Since we don't have standby nodes anymore, we don't need to close the
channels when the test finishes. Previously we would do so to make sure
the standby nodes have a clean state for the next test case, which is no
longer relevant.
2024-12-20 19:38:06 +08:00
yyforyongyu
11c9dd5ff2 itest: remove unused method setupFourHopNetwork 2024-12-20 19:38:05 +08:00
yyforyongyu
de8f14bed2 itest: remove the use of standby nodes
This commit removes the usage of the standby nodes and uses
`CreateSimpleNetwork` when applicable. Also introduces a helper method
`NewNodeWithCoins` to quickly start a node with funds.
2024-12-20 19:38:05 +08:00
yyforyongyu
3eda87fff9 itest: remove direct reference to stanby nodes
Prepares the upcoming refactor. We now never call `ht.Alice` directly,
instead, we always init `alice := ht.Alice` so it's easier to see how
they are removed in a following commit.
2024-12-20 19:38:05 +08:00
yyforyongyu
425877e745 itest: remove redundant block in multiple tests 2024-12-20 17:54:12 +08:00
yyforyongyu
653a8ac55e lntest+itest: add new method AssertChannelInGraph
This commit replaces `AssertTopologyChannelOpen` with
`AssertChannelInGraph`, which asserts a given channel edge is found.
`AssertTopologyChannelOpen` only asserts a given edge has been received
via the topology subscription, while we need to make sure the channel is
in the graph before continuing our tests.
2024-11-12 23:55:40 +08:00
yyforyongyu
d27ff34b04 lntest+itest: rename AssertNumEdges to AssertNumActiveEdges
To properly reflect what the assertion is.
2024-11-11 20:57:49 +08:00
ziggie
64fb4cb4ac itest: fix blinded path itest. 2024-08-29 09:50:46 +02:00
Elle Mouton
b0852a22fd lnwallet+itest: fix PaymentDescriptor creation for blinded path htlc
This commit fixes the instantiation of the BlindingPoint member of
PaymentDescriptor during the conversion from persisted LogUpdates.
Previously, the blinding point was not set correctly. The test from the
previous commit is also updated to now assert that this behaviour is now
correct.
2024-08-27 18:18:15 +02:00
Elle Mouton
9ac8e673b4 itest: demonstrate UpdateAddHTLC reloading bug
This commit adds a new route blinding itest that demonstrates that the
reloading and re-forwarding of an UpdateAddHTLC message on restart
currently is done incorrectly for a blinded path payment. This is due to
the fact that the blinding point member is not currently set correctly.
This is fixed in the next commit which will also change the test to
assert that the behaviour is now correct.
2024-08-27 18:18:10 +02:00
yyforyongyu
8259e0fb5f itest: remove redundant call to ht.WaitForBlockchainSync
This check has already been done when mining blocks.
2024-08-09 22:01:57 +08:00
Elle Mouton
5e84ba92af multi: add IsBlinded to lnrpc.Invoice for nicer UX
The BlindedPathConfig struct is nice for invoice creation but when we
use the Invoice message for viewing an invoice, it would be nicer to see
an "is_blinded" field.
2024-08-08 16:46:01 +02:00
Elle Mouton
697f514d09 blindedpath: log chosen blinded paths
In this commit, we log selected blinded paths.
2024-08-07 17:03:12 +02:00
Elle Mouton
3de6c5415a multi: let blinded path invoice options be set per addinvoice call
Extend the configurability of blinded paths in invoices by adding the
ability to change the global config options on a per-RPC basis.
2024-08-07 17:02:55 +02:00
Elle Mouton
e416501802 itest: test sending MP payment over multiple blinded paths 2024-07-31 09:36:06 +02:00
Elle Mouton
398623bde5 blindedpath: move blinded path logic to own pkg 2024-07-26 09:54:59 +02:00
Elle Mouton
c62a9c235e itest: test blinded paths over private channels 2024-07-26 09:54:38 +02:00
Elle Mouton
66765de413 itest: add route blinding dummy hops test
Add an itest that tests the addition of dummy hops to a blinded path. By
testing that invoices containing such a path can be paid, it also tests
the peeling of dummy hops by the receiver.
2024-07-26 09:54:38 +02:00
Elle Mouton
f0558babf3 multi: send MPP payment to blinded path
Make various sender side adjustments so that a sender is able to send an
MP payment to a single blinded path without actually including an MPP
record in the payment.
2024-07-26 09:54:38 +02:00
Elle Mouton
64a99d4a8e itest: end to end route blinding invoices test
Update one of the route blinding itests to do a full end-to-end test
where the recipient generates and invoice with a blinded path and the
sender just provides that invoice to SendPayment.

The tests also covers the edge case where the recipient is the
introduction node.
2024-07-26 09:54:38 +02:00
Elle Mouton
34d8fff5f9 itest: update route blind tests
The route blinding itests are now updated so that recipient logic is
tested. The creation of a blinded route is also now done through the
AddInvoice API instead of manually.
2024-07-26 09:54:18 +02:00
Elle Mouton
4457ca2e66 record: stricter type for PaymentRelayInfo.BaseFee
In this commit, we update the PaymentRelayInfo struct's BaseFee member
to use a stricter type (lnwire.MilliSatoshi) instead of an ambigious
uint32.
2024-07-26 09:53:49 +02:00
yyforyongyu
be4dba5da6 lntest+itest: finalize moving miner methods 2024-07-23 21:30:07 +08:00
yyforyongyu
e553895ddd lntest+itest: strictly define the behavior of MineBlocks
This commit adds more assertion to `MineBlocks` so the caller won't
misuse it.
2024-07-23 21:30:07 +08:00
Elle Mouton
ad0905f10e record+htlcswitch: convert BlindedRouteData fields to optional
For the final hop in a blinded route, the SCID and RelayInfo fields will
_not_ be set. So these fields need to be converted to optional records.

The existing BlindedRouteData constructor is also renamed to
`NewNonFinalBlindedRouteData` in preparation for a
`NewFinalBlindedRouteData` constructor which will be used to construct
the blinded data for the final hop which will contain a much smaller set
of data. The SCID and RelayInfo parameters of the constructor are left
as non-pointers in order to force the caller to set them in the case
that the constructor is called for non-final nodes. The other option
would be to create a single constructor where all parameters are
optional but I think this makes it easier for the caller to make a
mistake.
2024-07-10 09:12:39 +02:00
yyforyongyu
9f34a4dc54 itest: skip error assertion when parent context finishes
We may get a flake like the following,
```
lnd_route_blinding_test.go:468:
            Error Trace:    /Users/runner/work/lnd/lnd/itest/lnd_route_blinding_test.go:468
                                        /Users/runner/hostedtoolcache/go/1.22.3/arm64/src/runtime/asm_arm64.s:1222
            Error:          Received unexpected error:
                            rpc error: code = Canceled desc = context canceled
            Test:           TestLightningNetworkDaemon/tranche15/144-of-156/bitcoind/disable_introduction_node
```

This happens when the test successfully finishes, the parent context is
canceled, causing the child context to return an error. We fix it by
ignoring it in the goroutine.
2024-06-13 17:54:30 +08:00
Carla Kirk-Cohen
6e3a46ee91 itest: add more comprehensive assertions before HTLC cleared check
We mine quite a few blocks in this test to trigger a htlc timeout,
so it can be pretty slow. This fix adds assertions for additional
"state steps" that happen in between the failing of the htlc on-chain
and asserting that we're fully cleared out so that slower running
machines won't timeout.
2024-04-27 11:42:35 -04:00
Carla Kirk-Cohen
75d4a4c295 itest: add coverage for blinded error resolution from on-chain failure
This itest adds a test that we still propagate blinded errors back
properly after a restart with an on-chain resolution. The test also
updates our sendpayment timeout to longer so that there's time to
resolve the on chain claim.
2024-04-26 11:35:17 -04:00
Carla Kirk-Cohen
2140f1940f itest: manually set timeout on cancel payment and provide cancel
For tests where our payments require an on-chain resolution,
provide longer timeout and return cancel functions.
2024-04-26 10:56:33 -04:00
Carla Kirk-Cohen
d57c6fab47 itest: add coverage for disabling blinded forwards 2024-04-25 09:47:17 -04:00
Carla Kirk-Cohen
428a33fbda itest: add coverage for failure at the introduction node 2024-04-25 09:47:16 -04:00
Carla Kirk-Cohen
4535cf6c65 itest: add coverage for failure within a blinded route 2024-04-25 09:47:15 -04:00
Carla Kirk-Cohen
d13a73a93a itest: add test coverage for failure at blinded receiver 2024-04-25 09:47:14 -04:00
yyforyongyu
a1a480a81c itest+lntest: add itest testSweepHTLCs to check HTLC sweepings 2024-04-19 21:33:36 +08:00
Carla Kirk-Cohen
0d9a184df8 lntest: dispatch and intercept payment to blinded route
We don't support receiving blinded in this PR - just intercept and
settle instead. The HTLC's arrival on the interceptor indicates that
it was successfully forwarded on a blinded hop.
2024-04-03 09:19:42 -04:00
Carla Kirk-Cohen
69e1162dd1 lntest: add route construction to blinded forwarding test 2024-04-03 09:19:41 -04:00
Carla Kirk-Cohen
58dda83b22 lntest: add helper to create blinded route 2024-04-03 09:19:40 -04:00
Carla Kirk-Cohen
a72aaa3d84 lntest: add setup for blinded route forwarding itest
Note: the itest is broken up into multiple commits to make it
more readable, they can be squashed post-review.
2024-04-03 09:19:39 -04:00