Commit Graph

15435 Commits

Author SHA1 Message Date
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
Elle Mouton
a24a4c2996 zpay32: remove litecoin tests 2023-10-06 16:34:47 -07:00
Elle Mouton
94c4642db6 lncfg+config: only allow btcd or bitcoind backends 2023-10-06 16:34:47 -07:00
Elle Mouton
913aa36fe9 chainreg: remove Litecoin support
This commit removes the Litecoin, LtcMode and LitcoinMode members from
the chainreg `Config` struct.
2023-10-06 16:34:47 -07:00
Elle Mouton
a76bdf606b chainreg: let IsTestnet consider bitcoin only 2023-10-06 16:34:47 -07:00
Elle Mouton
d128c18cc5 keychain+chainreg: remove Litecoin CoinType 2023-10-06 16:34:47 -07:00
Elle Mouton
3912d5a0c6 multi: remove Litecoin config options
This commit removes the `Litecoin`, `LtcMode` and `LitecoindMode`
members from the main LND `Config` struct. Since only the bitcoin
blockchain is now supported, this commit also deprecates the
`cfg.Bitcoin.Active` config option.
2023-10-06 16:34:47 -07:00
Elle Mouton
ba93cde07a sample-lnd.conf: remove litecoin conf options 2023-10-06 16:34:47 -07:00
yyforyongyu
f6664d572e docs: update release notes for payment status 2023-10-06 16:34:47 -07:00
yyforyongyu
36f9d7b8db routerrpc: make sure error is transformed into grpc error code 2023-10-06 16:34:47 -07:00
yyforyongyu
17a0a8de06 cmd+lntest: use the new rpc field Payment_INITIATED 2023-10-06 16:34:47 -07:00
yyforyongyu
65879a45e6 lnrpc: update routerrpc to use the new status 2023-10-06 16:34:47 -07:00