Commit Graph

16897 Commits

Author SHA1 Message Date
Elle Mouton
cd3da40fb9
routing: dont include final hop cltv in blinded path
Only include the final hop's cltv delta in the total timelock
calculation if the route does not include a blinded path. This is
because in a blinded path, the final hops final cltv delta will be
included in the blinded path's accumlated cltv delta value.

With this commit, we remove the responsibility of remembering not to set
the `finalHop.cltvDelta` from the caller of `newRoute`. The relevant
test is updated accordingly.
2024-07-10 17:51:56 +02:00
Elle Mouton
93f89512ae
lnrpc+rpcserver: Add blinded payment paths to PayReq
This commit adds a blinded_paths field to the PayReq proto message. A
new helper called `CreateRPCBlindedPayments` is then added to convert
the zpay32 type to the existing `lnrpc.BlindedPaymentPath` type and add
this to the `PayReq` in the `DecodePayReq` rpc method.
2024-07-10 17:51:55 +02:00
Elle Mouton
f6a54c2ede
zpay: encoding and decoding of a BlindedPaymentPath
In this commit, the ability is added to encode blinded payment paths and
add them to a Bolt 11 invoice.
2024-07-10 17:51:55 +02:00
Elle Mouton
9ada4a9068
record: add Padding field to BlindedRouteData
When we start creating blinded paths to ourselves, we will want to be
able to pad the data for each hop so that the `encrypted_recipient_data`
for each hop is the same. We add a `PadBy` method that allows a caller
to add a certain number of bytes to the padding field. Note that adding
n bytes won't always mean that the encoded payload will increase by size
n since there will be overhead for the type and lenght fields for the new
TLV field. This will also be the case when the number of bytes added
results in a BigSize bucket jump for TLV length field. The
responsibility of ensuring that the final payloads are the same size is
left to the caller who may need to call PadBy iteratively to achieve the
goal. I decided to leave this to the caller since doing this at the
actual TLV level will be quite intrusive & I think it is uneccessary to
touch that code for this unique use case.
2024-07-10 09:12:40 +02:00
Elle Mouton
15f3cce27d
record: add PathID to BlindedRouteData
Add the PathID (tlv type 6) field to BlindedRouteData. This will be used
for the final hop of a blinded route. A new constructor is also added
for BlindedRouteData which can specifically be used for the final hop.
2024-07-10 09:12:40 +02:00
Elle Mouton
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
Elle Mouton
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
Elle Mouton
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
Elle Mouton
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
Elle Mouton
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
Oliver Gugger
a9655357ca
Merge pull request #8855 from bhandras/invoice-expiry-migration
sqldb+invoices: fix incorrectly stored invoice expiries when using native SQL
2024-07-09 02:06:28 -06:00
Andras Banki-Horvath
053faa6229
docs: update release notes for 0.18.3-beta 2024-07-09 08:39:58 +02:00
Andras Banki-Horvath
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
Andras Banki-Horvath
95b99420fa
sqldb: add unit test for the invoice expiry migration 2024-07-09 08:39:57 +02:00
Andras Banki-Horvath
ed36598504
sqldb: add helpers to create test DBs migrated up to a select version 2024-07-09 08:39:57 +02:00
Andras Banki-Horvath
5292c76e10
sqldb: extract migration into method
Based on: https://github.com/lightninglabs/taproot-assets/pull/707
2024-07-09 08:39:57 +02:00
Andras Banki-Horvath
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
Yong
3526f82b5d
Merge pull request #8887 from yyforyongyu/fix-err-match
multi: fix `lnwallet.ErrDoubleSpend`
2024-07-08 14:09:07 +08:00
yyforyongyu
e27a656c07
docs: add release notes for 0.18.3 2024-07-06 14:01:40 +08:00
yyforyongyu
26a365eb32
docs: update release notes 2024-07-06 13:59:28 +08:00
yyforyongyu
8f4bcd0b3a
lnwallet: fix ErrDoubleSpend 2024-07-06 13:59:28 +08:00
yyforyongyu
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
yyforyongyu
e0a506ab26
multi: use chain.MapRPCErr instead of rpcclient.MapRPCErr 2024-07-06 13:59:25 +08:00
yyforyongyu
1d40c55550
gomod: update btcwallet to include RPC errors 2024-07-06 13:55:12 +08:00
Elle
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
Andras Banki-Horvath
b35f0606ba
docs: update release notes for 0.18.2-beta 2024-07-04 17:32:12 +02:00
Andras Banki-Horvath
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
Andras Banki-Horvath
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
Elle
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
Elle Mouton
9d1320a2d0
docs: add release notes entry 2024-06-27 15:27:23 -07:00
Elle Mouton
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
Oliver Gugger
c34c0426fa
Merge pull request #8874 from ellemouton/assumeTLV2
routing: remove left over TLV feature bit checks
2024-06-27 01:34:54 -06:00
Oliver Gugger
3ceb7d5887
docs: update release notes 2024-06-26 14:30:28 -07:00
Oliver Gugger
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
Oliver Gugger
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
yyforyongyu
7fd099b146
docs: update release notes and add notes for 0.18.2 2024-06-26 01:44:00 +08:00
yyforyongyu
3b4106ca00
mod: update btcd and btcwallet versions 2024-06-26 00:41:17 +08:00
Elle
6b64703db4
Merge pull request #8791 from ellemouton/assumeTLV
routing: assume TLV onion feature bit
2024-06-24 11:03:33 -07:00
Elle Mouton
738206fa96
docs: add release notes entry 2024-06-24 10:01:41 -07:00
Elle Mouton
99b3c57b7f
routing: assume TLV onion during route construction 2024-06-24 10:01:23 -07:00
Elle Mouton
738253f5e1
routing: assume TLV onion during path finding 2024-06-24 10:01:21 -07:00
Oliver Gugger
fb416c2fa2
Merge pull request #8856 from AbelLykens/patch-1
[docs] Update go instructions
2024-06-22 02:15:42 -06:00
AbelLykens
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
Olaoluwa Osuntokun
376b8cedc4
Merge pull request #8853 from Roasbeef/result-utils
fn: add additional utility methods for Result[T]
2024-06-20 16:11:26 -07:00
Olaoluwa Osuntokun
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
Oliver Gugger
390f0723d3
Merge pull request #8838 from yyforyongyu/update-pendingsweeps
cli: update `pendingsweeps` response
2024-06-20 07:13:00 -06:00
Elle
2477bd756f
Merge pull request #8549 from matheusdtech/mc-store-perf-improv
Misson Control Store: Improve performance
2024-06-19 09:15:07 -07:00
Elle
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
Matheus Degiovani
f39edaa19a
docs: update release notes 2024-06-19 07:35:46 -03:00
Matheus Degiovani
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