Commit Graph

15446 Commits

Author SHA1 Message Date
Carla Kirk-Cohen
b42a621438 lntest: add coverage for single hop blinded route query routes 2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
eb31ff553b lntest/itest: add coverage for querying routes to blinded paths 2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
0e179fae1e routing: remove 0-value warning log in pathfinding
Blinded routes can now have "hints" that have zero value edges, so we
remove this log to avoid spamming logs.
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
cae22dc862 lnrpc: add blinded payment to QueryRoutes request 2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
63b4ac8057 lnrpc/refactor: move query routes request parsing into method 2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
c2aebe2aa9 lnrpc: surface blinded payment fields in hops 2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
014683ee66 routing: include route blinding fields in blinded portion of path
This commit updates route construction to backfill the fields
required for payment to blinded paths and set amount to forward
and expiry fields to zero for intermediate hops (as is instructed
in the route blinding specification).

We could attempt to do this in the first pass, but that loop
relies on fields like amount to forward and expiry to calculate
each hop backwards, so we keep it simple (stupid) and post
processes the blinded portion, since it's computationally cheap
and more readable.
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
c9609b8214 multi: add blinded route to route requests expressed as hints
Add the option to include a blinded route in a route request (exclusive
to including hop hints, because it's incongruous to include both), and
express the route as a chain of hop hints.

Using a chain of hints over a single hint to represent the whole path
allows us to re-use our route construction to fill in a lot of the
path on our behalf.
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
48e36d93d4 multi/refactor: add RouteRequest to hold FindRoute parameters
This commit introduces a single struct to hold all of the parameters
that are passed to FindRoute. This cleans up an already overloaded
function signature and prepares us for handling requests with blinded
routes where we need to perform some additional processing on our
para (such as extracting the target node from the blinded path).
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
11a007dc16 routing: account for blinded routes in fee calculation
When we introduce blinded routes, some of our hops are expected
to have zero amounts to forward in their hop payload. This commit
updates our hop fee logic to attribute the full blinded route's
fees to the introduction node. We can't actually know where/how
these fees are distributed, so we collect them all at the
introduction node.
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
940b491051 routing: only pack amount and cltv if populated
With the addition of blinded routes, we now need to account for the
possibility that intermediate nodes payloads will not have an amount
and expiry set because that information is provided by the recipient
encrypted data blob. This commit updates our payload packing to only
optionally include those fields.
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
fee0e05708 multi: add blinded path TLVs to onion payload / hops
This commit adds the encrypted_data, blinding_point and total_amt_msat
tlvs to the known set of even tlvs for the onion payload. These TLVs
are added in two places (the onion payload and hop struct) because
lnd uses the same set of TLV types for both structs (and they
inherently represent the same thing).

Note: in some places, unit tests intentionally mimic the style
of older tests, so as to be more consistently readable.
2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
539a275faa routing: add representation of blinded payments
This commit adds a representation of blinded payments, which include a
blinded path and aggregate routing parameters to be used in payment to
the path.
2023-10-06 16:38:33 -07:00
yyforyongyu
20e7e801c0 routing+channeldb: use HTLCAttempt instead of HTLCAttemptInfo
This commit refactors the params used in lifecycle to prefer
`HTLCAttempt` over `HTLCAttemptInfo`. This change is needed as
`HTLCAttempt` also wraps settled and failure info, which is useful in
the following commits.
2023-10-06 16:38:33 -07:00
yyforyongyu
a6be939bfa routing: add newPaymentLifecycle to properly init lifecycle
This commit adds a new method to properly init a payment lifecycle so we
can easily see the default values used here.
2023-10-06 16:38:33 -07:00
yyforyongyu
34d0e5d4c5 routing+channeldb: make MPPayment into an interface
This commit turns `MPPayment` into an interface inside `routing`. Having
this interface gives us the benefit to write more granular unit tests
inside payment lifecycle. As seen from the modified unit tests, several
hacky ways of testing the `SendPayment` method is now replaced by a mock
over `MPPayment`.
2023-10-06 16:38:33 -07:00
yyforyongyu
c412ab5ccb routing: add exitWithErr to handle error logging 2023-10-06 16:38:33 -07:00
yyforyongyu
e5840f6216 channeldb+routing: add NeedWaitAttempts to decide waiting for attempts
This commit adds a new method, `NeedWaitAttempts`, to properly decide
whether we need to wait for the outcome of htlc attempts based on the
payment's current state.
2023-10-06 16:38:33 -07:00
yyforyongyu
89ac071e56 channeldb: add HasSettledHTLC and PaymentFailed fields to state 2023-10-06 16:38:33 -07:00
yyforyongyu
52c00e8cc4 multi: move payment state handling into MPPayment
This commit moves the struct `paymentState` used in `routing` into
`channeldb` and replaces it with `MPPaymentState`. In the following
commit we'd see the benefit, that we don't need to pass variables back
and forth between the two packages. More importantly, this state is put
closer to its origin, and is strictly updated whenever a payment is read
from disk. This approach is less error-prone comparing to the previous
one, which both the `payment` and `paymentState` need to be updated at
the same time to make sure the data stay consistant in a parallel
environment.
2023-10-06 16:38:31 -07:00
yyforyongyu
bf99e42f8e routing: rename handleSendError to handleSwitchErr
This commit renames the `handleSendError` to be `handleSwitchErr` to
explicitly express that it's handling the error from htlcswitch.
2023-10-06 16:34:47 -07:00
yyforyongyu
42f1c0f1cc routing: refactor createNewPaymentAttempt and sendPaymentAttempt
This commit moves the creations of hop and htlcAdd message from
`createNewPaymentAttempt` to `sendPaymentAttempt` to clean up the code
and further pave the way to decomposite the lifecycle.
2023-10-06 16:34:47 -07:00
yyforyongyu
3c8784dca3 routing: change variable name numShardsInFlight -> numAttemptsInFlight 2023-10-06 16:34:47 -07:00
yyforyongyu
942697ae73 routing: shorten variable name currentState -> ps 2023-10-06 16:34:47 -07:00
yyforyongyu
3259557a46 routing: fix format and add more docs 2023-10-06 16:34:47 -07:00
yyforyongyu
25d82fd62b rpcserver+sweep: fix linter re unused params 2023-10-06 16:34:47 -07:00
yyforyongyu
24fa35ec80 multi: make sure CPFP won't exceed max allowed fee rate
This commit updates the `fee()` method in `weightEstimator` to make sure
when doing CPFP we are not exceeding the max allowed fee rate. In order
to use the max fee rate, we need to modify several methods to pass the
configured value to the estimator.
2023-10-06 16:34:47 -07:00
yyforyongyu
42ff52bbfb sweep: cap to max fee rate instead of failing
This commit caps the estimated fee rate at the configged max fee rate
instead of returning an error.
2023-10-06 16:34:47 -07:00
yyforyongyu
32fccc434b docs: update release note for maxfeerate 2023-10-06 16:34:47 -07:00
yyforyongyu
063fb9dd43 multi: make max fee rate configurable 2023-10-06 16:34:47 -07:00
yyforyongyu
258fe7999b sweep+itest: change MaxFeeRate to use SatPerVbyte 2023-10-06 16:34:47 -07:00
yyforyongyu
bea0ffdf81 chainfee: add new unit SatPerVByte 2023-10-06 16:34:47 -07:00
yyforyongyu
60a44c3f53 sweep: lower the max allowed fee rate for sweeping inputs
This commit changes the DefaultMaxFeeRate from 10,120 sat/vb to 1,000
sat/vb.
2023-10-06 16:34:47 -07:00
yyforyongyu
66b8700c0b multi: add debug logs to catch slow shutdown 2023-10-06 16:34:47 -07:00
yyforyongyu
ba007d9373 itest: fix itest logs upload
When one of the itest tranches fails, because we are running tests in
parallel, other tranches will still be running, which caused 7z to fail
at zipping the logs because race reads. This commit fixes it by making
sure we are waiting other tranches to finish before moving to zipping
and uploading the logs.
2023-10-06 16:34:47 -07:00
Matt Morehouse
3549e329df lnwire: encode channel_update type in onion errors
For about a year [1], the spec has prescribed encoding channel_updates
with their type prefix (0x0102) in onion failure messages. LND can
decode correctly with or without the prefix but hasn't been writing the
prefix during encoding. This commit starts writing the prefix.

[1] https://github.com/lightning/bolts/pull/979
2023-10-06 16:34:47 -07:00
Elle Mouton
53b33c75c4 config: edit error strings to account for signet option 2023-10-06 16:34:47 -07:00
Elle Mouton
1211e7eb7b multi: use "bitcoin" chain name constant
Make use of the `bitcoinChainName` constant instead of re-writing the
"bitcoin" string.
2023-10-06 16:34:47 -07:00
Elle Mouton
8a195ed761 sample-lnd.conf: replace ${chain} with "bitcoin" 2023-10-06 16:34:47 -07:00
Elle Mouton
275201de5b scripts: remove litecoin strings from script 2023-10-06 16:34:47 -07:00
Elle Mouton
a454a8ab44 docs: add release note for 7867 2023-10-06 16:34:47 -07:00
Elle Mouton
23a63ef328 config: update to satisfy linter 2023-10-06 16:34:47 -07:00
Elle Mouton
a7e723e570 lncli: remove chain option from profile 2023-10-06 16:34:47 -07:00
Elle Mouton
7fa05f92f5 htlcswitch: remove Network type 2023-10-06 16:34:47 -07:00
Elle Mouton
77908d6c92 lnrpc: deprecate chains field in GetInfoResponse 2023-10-06 16:34:47 -07:00
Elle Mouton
031dbd7760 multi: remove ChainRegistry 2023-10-06 16:34:47 -07:00
Elle Mouton
2a7fffe441 lnrpc: remove litecoin from lightning.proto 2023-10-06 16:34:47 -07:00
Elle Mouton
215e0f26fe docker: remove litcoin docker scripts 2023-10-06 16:34:47 -07:00
Elle Mouton
0d89a45abe docs: remove Litecoin references from INSTALL.md file 2023-10-06 16:34:47 -07:00
Elle Mouton
be90bcbe46 multi: remove litecoin references and comments 2023-10-06 16:34:47 -07:00