Commit Graph

15578 Commits

Author SHA1 Message Date
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
yyforyongyu
c175386c4d channeldb+routing: apply method Terminated to decide a payment's terminal state
This commit applies the new method `Terminated`. A side effect from
using this method is, we can now save one query `fetchPayment` inside
`FetchInFlightPayments`.
2023-10-06 16:34:47 -07:00
yyforyongyu
fac6044501 channeldb: add unit test for decidePaymentStatus 2023-10-06 16:34:47 -07:00
yyforyongyu
390f3c8253 channeldb: expand PaymentStatus to explicitly represent payment status
This commit introduces more granular statuses to better determine a
payment's current state. Based on whether there are inflight HTLCs, the
state of each of the HTLCs, and whether the payment is failed, a total
of 5 states are derived, which can give a finer control over what action
to take based on a given state.

Also, `fetchPayment` now uses `decidePaymentStatus`. After applying the
new function, the returned payment status would be different,

```
| inflight | settled | failed | reason |       previous  ->   now          |
|:--------:|:-------:|:------:|:------:|:---------------------------------:|
|   true   |   true  |  true  |   yes  |    StatusInFlight(unchanged)      |
|   true   |   true  |  true  |   no   |    StatusInFlight(unchanged)      |
|   true   |   true  |  false |   yes  |    StatusInFlight(unchanged)      |
|   true   |   true  |  false |   no   |    StatusInFlight(unchanged)      |
|   true   |   false |  true  |   yes  |    StatusInFlight(unchanged)      |
|   true   |   false |  true  |   no   |    StatusInFlight(unchanged)      |
|   true   |   false |  false |   yes  |    StatusInFlight(unchanged)      |
|   true   |   false |  false |   no   |    StatusInFlight(unchanged)      |
|   false  |   true  |  true  |   yes  |    StatusSucceeded(unchanged)     |
|   false  |   true  |  true  |   no   |    StatusSucceeded(unchanged)     |
|   false  |   true  |  false |   yes  |    StatusSucceeded(unchanged)     |
|   false  |   true  |  false |   no   |    StatusSucceeded(unchanged)     |
|   false  |   false |  true  |   yes  |     StatusFailed(unchanged)       |
|   false  |   false |  true  |   no   |     StatusInFlight(unchanged)     |
|   false  |   false |  false |   yes  |     StatusFailed(unchanged)       |
|   false  |   false |  false |   no   |  StatusInFlight -> StatusInitiated|
```
2023-10-06 16:34:47 -07:00
yyforyongyu
09b67af48d channeldb: add method Registrable to decide adding HTLCs
This commit adds a new method, `Registrable`, to help decide whether
adding new HTLCs to a given payment is allowed. A new unit test,
`TestRegistrable` is also added to test it.
2023-10-06 16:34:47 -07:00
yyforyongyu
c71601124a channeldb: fix variable name used in RegisterAttempt
Renamed `p` to `payment` to since it's used by the method's pointer receiver.
2023-10-06 16:34:47 -07:00
yyforyongyu
105c275b91 channeldb: add method updatable to decide updating payments
This commit adds a new method, `updatable`, to help decide whether
updating a given payment is allowed.
2023-10-06 16:34:47 -07:00
yyforyongyu
a6f4f0dfc9 channeldb: add method removable to decide removing payments
This commit adds a new method, `removable`, to help decide whether
deleting a payment is allowed.
2023-10-06 16:34:47 -07:00
yyforyongyu
de33c3e009 channeldb: add method initializable to decide initiating payment
This commit adds a new method, `initializable`, to help decide whether
initiating a payment is allowed.
2023-10-06 16:34:47 -07:00
yyforyongyu
30fd29371c channeldb: add new payment status StatusInitiated
This commit adds a new payment status, `StatusInitiated`, to properly
represent the state where a payment is newly created without attempting
any HTLCs. Since the `PaymentStatus` is a memory representation of a
given payment's status, the enum used for the statuses are directly
updated.
2023-10-06 16:34:47 -07:00