Commit Graph

16741 Commits

Author SHA1 Message Date
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
925b68c1ed routing: add BlindedPayment to unifiedEdge
Later on in this series, we will need to know during path finding if an
edge we are traversing was derived from a blinded payment path. In
preparation for that, we add a BlindedPayment member to the
`unifiedEdge` struct.

The reason we will need this later on is because: In the case where we
receive multiple blinded paths from the receipient, we will first swap
out the final hop node of each path with a single unified target node so
that path finding can work as normal. Once we have selected a route
though, we will want to know which path an edge belongs to so that we
can swap the correct destination node back in.
2024-07-10 09:12:39 +02:00
1ec2a1be11 routing+refactor: add a constructor for unifiedEdge
Add a constructor for unified edge. In upcoming commits, we will add a
new member to unifiedEdge and a constructor forces us to not forget to
populate a required member.
2024-07-10 09:12:39 +02:00
28d1227c04 routing: add BlindedPayment() method to AdditionalEdges
Expand the AdditionalEdges interface with a BlindedPayment method. In
upcoming commits, we will want to know if an AdditionalEdge was derived
from a blinded payment or not and we will also need some information
from the blinded payment it was derived from. So we expand the interface
here to avoid needing to do type casts later on. The new method may
return nil if the edge was not derived from a blinded payment.
2024-07-10 09:12:39 +02:00
f7a9aa875e routing+refactor: let BlindedEdge carry BlindedPayment
This commit is purely a refactor. In it, we let the `BlindedEdge` struct
carry a pointer to the `BlindedPayment` that it was derived from. This
is done now because later on in the PR series, we will need more
information about the `BlindedPayment` that an edge was derived from.

Since we now pass in the whole BlindedPayment, we swap out the
`cipherText` member for a `hopIndex` member so that we dont carry around
two sources of truth in the same struct.
2024-07-10 09:12:39 +02:00
a9655357ca Merge pull request #8855 from bhandras/invoice-expiry-migration
sqldb+invoices: fix incorrectly stored invoice expiries when using native SQL
sqldb/v1.0.3
2024-07-09 02:06:28 -06:00
053faa6229 docs: update release notes for 0.18.3-beta 2024-07-09 08:39:58 +02:00
d0c1cec8c1 sqldb: switch away from pq to pgx for Postgres
Completely switch to the better maintained pgx driver.
2024-07-09 08:39:58 +02:00
95b99420fa sqldb: add unit test for the invoice expiry migration 2024-07-09 08:39:57 +02:00
ed36598504 sqldb: add helpers to create test DBs migrated up to a select version 2024-07-09 08:39:57 +02:00
5292c76e10 sqldb: extract migration into method
Based on: https://github.com/lightninglabs/taproot-assets/pull/707
2024-07-09 08:39:57 +02:00
323af946e0 sqldb+invoices: add migration to fix incorrectly stored invoice expiries
Previously, when using the native schema, invoice expiries were incorrectly
stored as 64-bit values (expiry in nanoseconds instead of seconds), causing
overflow issues. Since we cannot determine the original values, we will set
the expiries for existing invoices to 1 hour with this migration.
2024-07-09 08:39:57 +02:00
3526f82b5d Merge pull request #8887 from yyforyongyu/fix-err-match
multi: fix `lnwallet.ErrDoubleSpend`
2024-07-08 14:09:07 +08:00
e27a656c07 docs: add release notes for 0.18.3 2024-07-06 14:01:40 +08:00
26a365eb32 docs: update release notes 2024-07-06 13:59:28 +08:00
8f4bcd0b3a lnwallet: fix ErrDoubleSpend 2024-07-06 13:59:28 +08:00
ddf46f435c multi: update RPC error import path
These errors are now defined in `btcwallet/chain` instead of
`btcd/rpcclient`.
2024-07-06 13:59:28 +08:00
e0a506ab26 multi: use chain.MapRPCErr instead of rpcclient.MapRPCErr 2024-07-06 13:59:25 +08:00
1d40c55550 gomod: update btcwallet to include RPC errors 2024-07-06 13:55:12 +08:00
d7e0f69f34 Merge pull request #8854 from bhandras/invoices-limit-offset-fixup
invoices: fix SQL invoice query pagination
2024-07-04 21:26:56 +02:00
b35f0606ba docs: update release notes for 0.18.2-beta 2024-07-04 17:32:12 +02:00
892561f8f0 sqldb: bump modernc.org/sqlite to 1.29.10 which fixes init data race
Tracking issue: https://gitlab.com/cznic/sqlite/-/issues/180
2024-07-04 17:32:12 +02:00
e45ed86263 invoices: fix and correctly cover paginated queries
Previously paginated queries offseted the add_index_get, add_index_let,
settle_index_get and settle_index_let parameters with the paginators
current page offset, however this was incorrect as we can just use
SQL's LIMIT/OFFSET to paginate. This commit fixes this issue and adds an
optional parameter to the constructor of the invoice SQL store to set
page size. This is useful when testing as we can now cover pagination
correctly with our existing unit tests.
2024-07-04 17:32:11 +02:00
71ba355d90 Merge pull request #8796 from ellemouton/acceptImplicitZeroConf
multi: allow min-depth of zero for non-zero conf channels
2024-06-28 07:19:46 -07:00
9d1320a2d0 docs: add release notes entry 2024-06-27 15:27:23 -07:00
1c65c3d072 funding: allow AcceptChannel with min depth of zero
Even if the channel type is not zero conf. We will still use a min depth
of at least 1. We just dont fail if our peer indicates trust.
2024-06-27 15:26:34 -07:00
c34c0426fa Merge pull request #8874 from ellemouton/assumeTLV2
routing: remove left over TLV feature bit checks
2024-06-27 01:34:54 -06:00
3ceb7d5887 docs: update release notes 2024-06-26 14:30:28 -07:00
b300da8446 routing: assume TLV payloads everywhere
This commit removes another check for TLV payload support of the
destination node. We assume TLV payloads as the default everywhere else,
so we just remove two checks that were previously forgotten.
2024-06-26 14:28:51 -07:00
ce813276d5 Merge pull request #8862 from yyforyongyu/fix-publish-err
Fix an error string match between different `btcd` versions
2024-06-25 12:40:39 -06:00
7fd099b146 docs: update release notes and add notes for 0.18.2 2024-06-26 01:44:00 +08:00
3b4106ca00 mod: update btcd and btcwallet versions 2024-06-26 00:41:17 +08:00
6b64703db4 Merge pull request #8791 from ellemouton/assumeTLV
routing: assume TLV onion feature bit
2024-06-24 11:03:33 -07:00
738206fa96 docs: add release notes entry 2024-06-24 10:01:41 -07:00
99b3c57b7f routing: assume TLV onion during route construction 2024-06-24 10:01:23 -07:00
738253f5e1 routing: assume TLV onion during path finding 2024-06-24 10:01:21 -07:00
fb416c2fa2 Merge pull request #8856 from AbelLykens/patch-1
[docs] Update go instructions
2024-06-22 02:15:42 -06:00
04f9a4faa4 [docs] Update go instructions
Building current lnd `0.18` fails with older go (`1.19.7`).

* Updated go download path to 1.22.4
* Updated hashes
* Added `rm -rf` instructions as per [go.dev instructions](https://go.dev/doc/install)
2024-06-21 19:27:52 +02:00
376b8cedc4 Merge pull request #8853 from Roasbeef/result-utils
fn: add additional utility methods for Result[T]
fn/v1.1.0
2024-06-20 16:11:26 -07:00
f1a38714d4 fn: add additional utility methods for Result[T]
`NewResult` makes it easy to wrap a normal function call in a result
value.

`Err` can be used to check the error case of the result without
unpacking the entire thing.

`AndThen2` allows a caller to compose a function on two results values,
with the closure only executing if both values are non-error.
2024-06-20 15:05:28 -07:00
390f0723d3 Merge pull request #8838 from yyforyongyu/update-pendingsweeps
cli: update `pendingsweeps` response
2024-06-20 07:13:00 -06:00
2477bd756f Merge pull request #8549 from matheusdtech/mc-store-perf-improv
Misson Control Store: Improve performance
2024-06-19 09:15:07 -07:00
2979afdc19 Merge pull request #8811 from hieblmi/fix-inbound-fee-typo
lncli: fix typo in inbound fee help text
2024-06-19 08:48:47 -07:00
f39edaa19a docs: update release notes 2024-06-19 07:35:46 -03:00
0c7a173354 missioncontrolstore: remove duplication of in-memory data
This removes duplication of in-memory data during the periodic flushing
stage of the mission control store.

The existing code entirely duplicates the in-memory cache of the store,
which is very wasteful when only a few additional results are being
rotated into the store.

This has a significant performance penalty specially for wallets that
remain online for a long time with a low volume of payments. The worst
case scenario are wallets that see at most 1 new payment a second, where
the entire in-memory cache is recreated every second.

This commit improves the situation by determining what will be the
actual changes that need to be committed before initiating the db
transaction and only keeping track of these to update the in-memory
cache if the db tx is successful.
2024-06-19 07:34:35 -03:00
9059a655db missioncontrolstore: avoid ticker when there is no work to be done.
This modifies the mission control store to avoid running the one second
ticker for flushing data when there is no work to be done.

This improves performance of a quiscent LN node by avoiding a one second
interval busy loop that does nothing when there are no payments flowing
through the node.
2024-06-19 07:34:35 -03:00
637ac85d1d missioncontrolstore: skip work when there are no new entries
This modifies the mission control store to avoid doing any work when no
new payment result entries are in the queue to be processed.

The mission control store maintains keeps the latest N (in production:
1000) entries in its DB, evicting older entries when new ones are added.
Currently, its implementation is somewhat less performant than it could
be.

This commit adds an early return to the storeResults function to avoid
doing any DB or memory operations when its outstanding queue is empty,
improving the performance during quiescent periods of the LN node's
execution.
2024-06-19 07:34:34 -03:00
6a27bc29ba missioncontrolstore: add additional tests and benchmarks
These will be useful in the next commits.
2024-06-19 07:33:14 -03:00
b66e361afa lncli: fix typo in inbound fee help text 2024-06-19 07:33:32 +02:00
c0f7c2849d Merge pull request #8822 from michael1011/fix-config-error-handling
cfg: fail startup on flags.Error parsing error
2024-06-18 17:51:24 -07:00