Commit Graph

15510 Commits

Author SHA1 Message Date
Yong
ca9cdacd5f
github: print debug logs for failed unit tests (#8083) 2023-10-12 12:50:11 +02:00
dependabot[bot]
3b933d5c5e
build(deps): bump golang.org/x/net from 0.10.0 to 0.17.0 in /healthcheck (#8085)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.10.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-12 10:46:07 +02:00
dependabot[bot]
3f67420722
build(deps): bump golang.org/x/net from 0.10.0 to 0.17.0 (#8084)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.17.0.
- [Commits](https://github.com/golang/net/compare/v0.10.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-12 10:45:45 +02:00
Amin Bashiri
039e9effe7
lnd: add http header timeout to config 2023-10-11 22:05:50 -06:00
András Bánki-Horváth
ad5cd9c8bb
multi: extend InvoiceDB methods with a context argument (#8066)
* multi: extend InvoiceDB methods with a context argument

This commit adds a context to InvoiceDB's methods. Along this refactor
we also extend InvoiceRegistry methods with contexts where it makes
sense. This change is essential to be able to provide kvdb and sqldb
implementations for InvoiceDB.

* channeldb: restrict invoice tests to only use an InvoiceDB instance

* docs: update release notes for 0.18.0
2023-10-11 13:42:59 +02:00
Eugene
9478b85e59
htlcswitch/hop: use InvalidOnionVersion for replayed packets (#7937)
* htlcswitch/hop: use InvalidOnionVersion for replayed packets

The link will send an update_fail_malformed_htlc, so we need to set
the BADONION bit. Since there isn't a replay-specific error, we
set the failure code to InvalidOnionVersion which has the BADONION bit.

* release-notes: update for 0.17.1
2023-10-11 10:08:43 +02:00
Oliver Gugger
abb1e3463f
scripts: kill lnd on windows to access log files (#8076)
For some reason lnd doesn't properly shut down on some windows itests,
and the process still running makes it impossible to access its log
files.
So for the Windows integration test, we attempt to kill the whole
process tree once the process indicates it is done.
2023-10-10 16:15:41 +02:00
Matt Morehouse
2d98dcf520
tlv: fuzz test encoding/decoding (#7889)
* tlv: fuzz tests for primitives

* tlv: fuzz tests for BigSize

We use a new harness to compare decoded values instead of encoded
values, since there may be some unparsed bytes in the original data.

* tlv: fuzz tests for truncated integers

These fuzz tests are identical to non-truncated integers, except that we
allow the fuzzer to choose decode lengths shorter than the length of
normal integers.

* tlv: fuzz tests for streams

* fixup! tlv: fuzz tests for truncated integers

loop over decode length

* fixup! tlv: fuzz tests for streams

better documentation
2023-10-10 14:01:41 +02:00
Olaoluwa Osuntokun
4f346060df
Merge pull request #8067 from lightningnetwork/0-18-staging-rebased
branch: merge 0.18 staging branch into master
2023-10-09 11:20:11 -07:00
Yong
ec2377db79
funding: remove dead code and sanity check pending chan ID (#7887)
* funding: remove unused field `newChanBarriers`

This commit removes the occurance of `newChanBarriers` as it's not used
anywhere.

* funding: rename method names to clear the funding flow

Slightly refactored the names so it's easier to see which side is
processing what messages.

* lnwallet: sanity check empty pending channel ID

This commit adds a sanity check to make sure an empty pending channel ID
will not be accepted.
2023-10-09 10:58:18 +02:00
Carla Kirk-Cohen
b994b6f9e0 docs: add release notes 2023-10-06 16:38:33 -07:00
Carla Kirk-Cohen
32ea77b96b lncli: add blinded route cli flags to query routes
Note: This commit can be dropped before merge, it's mostly added
to make the PR easier to manually test against other
implementations that have bolt 12 invoices implemented already!
2023-10-06 16:38:33 -07:00
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