Commit Graph

16844 Commits

Author SHA1 Message Date
Elle Mouton
3d9c77d1fc
htlcswitch+refactor: add rHash and sphinx.Router to sphinxHopIterator
This will be required to construct a new hop iterator for when peeling
of dummy hops is done for route blinding.
2024-07-26 09:54:18 +02:00
Elle Mouton
c1c2e1c6ce
htlcswitch+refactor: continue modularising extractTLVPayload
We further break up the extracTLVPayload into more modular pieces. The
pieces are structured in such a way as to prepare for extracTLVPayload
being called in a recursive manner from within
`deriveBlindedRouteForwardingInfo` when we add the logic for handling
dummy hops in a later commit. With this refactor, we completey remove
the BlindingKit's DecryptAndValidateFwdInfo method.
2024-07-26 09:54:18 +02:00
Elle Mouton
55c25f427f
htlcswitch+refactor: continue modularising extractTLVPayload
In this refactor commit, we extract all the steps from extractTLVPayload
that have to do with parsing the payload from the sender and verifying
the presence of various fields from the sender.
2024-07-26 09:54:18 +02:00
Elle Mouton
a15e4bb55f
refactor+htlcswitch: method for TLV payload parsing logic
In preparation for calling the TLV payload parsing logic recursively for
when we need to peel dummy hops from an onion, this commit creates a new
extractTLVPayload function. This is a pure refactor.
2024-07-26 09:54:18 +02:00
Elle Mouton
18cb7f0b87
lncli: add --blind option to addinvoice
In this commit, we expose the option to create an invoice containing
blinded paths to lncli.
2024-07-26 09:54:18 +02:00
Elle Mouton
de975334cd
multi: add blinded paths to invoices
Expose the ability to add blinded paths to an invoice. Also expose
various configuration values.

We also let the lncfg.Invoices struct satisfy the Validator interface so
that we can verify all its config values in one place.
2024-07-26 09:54:17 +02:00
Elle Mouton
e12a226272
routing: use mission control to select blinded paths
Add a `FindBlindedPaths` method to the `ChannelRouter` which will use
the new `findBlindedPaths` function to get a set of candidate blinded
path routes. It then uses mission control to select the best of these
paths.

Note that as of this commit, the MC data we get from these queries won't
mean much since we wont have data about a channel in the direction
towards us. But we do this now in preparation for a future PR which will
start writing mission control success pairs for successful receives from
blinded route paths.
2024-07-26 09:54:17 +02:00
Elle Mouton
1039aedd0c
routing: find blinded paths to a destination node
This commit adds a new function, `findBlindedPaths`, that does a depth
first search from the target node to find a set of blinded paths to the
target node given the set of restrictions. This function will select and
return any candidate path. A candidate path is a path to the target node
with a size determined by the given hop number constraints where all the
nodes on the path signal the route blinding feature _and_ the
introduction node for the path has more than one public channel. Any
filtering of paths based on payment value or success probabilities is
left to the caller.
2024-07-26 09:54:17 +02:00
Elle Mouton
9787ae9c89
lnrpc/invoicesrpc: prep AddInvoice for blinded routes
Here we add a new `Blind` option to the `AddInvoiceData` which will
signal that the new invoice should encode a blinded route.

Certain other changes are also made in the case that this invoice
contains a blinded route:
1) the payment address/secret no longer needs to be in the invoice
   itself since it will be put in the `PathID` recored of the encrypted
   recipient record for our hop.
2) When we sign the invoice, we now use an ephemeral key since we dont
   want the sender to be able to derive our real node pub key from the
   invoice signature.
3) The invoice's FinalCLTV field should be zero for blinded invoices
   since the CLTV delta info will be communicated in the accumulated
   route policy values.
2024-07-26 09:54:17 +02:00
Elle Mouton
4b5327f057
lnrpc/invoicesrpc: build blinded path
This commit adds all the logic for building a blinded path (from a given
route) and packaging it up in a zpay32.BlindedPaymentPath struct so that
it is ready for adding to an invoice. It also includes logic for padding
a path with dummy hops.

Note that in this commit, the logic for choosing an actual path to us
that can then be used in a blinded path is abstracted away. This logic
will be fleshed out in a future commit.
2024-07-26 09:54:17 +02:00
Elle Mouton
0855e3e71a
lnrpc/invoicesrpc: add blinded path policy buffer
This commit adds a helper function that will be used to adjust a hops
policy values by certain given increase and decrease multipliers. This
will be used in blinded paths to give policy values some buffer to avoid
easy probing of blinded paths.
2024-07-26 09:54:17 +02:00
Elle Mouton
3b2a6042ff
lnrpc/invoicesrpc: blinded path total path policy calc
This commit adds a function that can be used to compute the accumulated
path policy for a blinded path as defined in the spec:

db278ab9b2/04-onion-routing.md (L255)
2024-07-26 09:54:17 +02:00
Elle Mouton
f87cc6274f
lnrpc/invoicesrpc: add function for padding encrypted data
This commit adds a helper function called `padHopInfo` along with a test
for it. This function will be used later on when building a blinded
path. It is used to ensure that all encrypted blobs of a blinded path
that we construct are padded to the same size.
2024-07-26 09:54:16 +02:00
Elle Mouton
4457ca2e66
record: stricter type for PaymentRelayInfo.BaseFee
In this commit, we update the PaymentRelayInfo struct's BaseFee member
to use a stricter type (lnwire.MilliSatoshi) instead of an ambigious
uint32.
2024-07-26 09:53:49 +02:00
Elle Mouton
62a97f86dd
record: add NextNodeID type to BlindedRouteData
Add the NextNodeID TLV (tlv type 4) to the BlindedRouteData TLV stream.
This will be used during the dummy hop payload construction.
2024-07-26 09:53:49 +02:00
Elle Mouton
9192c165ff
feature: define new feature bit for bolt11 blinded paths
We need a new feature bit for BOLT11 invoices in order to indicate that
they contain the new blinded path tagged field. Tagged fields pre-date
TLV and so nodes who dont understand them will simply skip them.
Therefore the feature bit helps them to fail fast.
2024-07-26 09:53:49 +02:00
Elle Mouton
188dd44b42
zpay32: improve readability of blinded path encoding 2024-07-26 09:53:49 +02:00
Elle Mouton
4f5dd20f7e
go.mod: update lightning-onion dep 2024-07-26 09:53:48 +02:00
Olaoluwa Osuntokun
8c0d7862c2
Merge pull request #8937 from Roasbeef/go-1-22-5
build: update to Go 1.22.5
2024-07-25 13:14:57 -07:00
Olaoluwa Osuntokun
bc2922232c
build: remove old Travis references
We no longer use Travis.
2024-07-25 13:14:26 -07:00
Oliver Gugger
b40f165310
Merge pull request #8891 from yyforyongyu/fix-fee-estimator
chainfee: allow specifying min relay feerate from the API source
2024-07-25 11:40:18 -06:00
yyforyongyu
d992cf94d6
multi: add SpewLogClosure to avoid code repetition 2024-07-25 22:18:49 +08:00
yyforyongyu
b6049ff94b
multi: add NewLogClosure in lnutils to avoid repetition
And replaces all usage of `logClosure` with `lnutils.LogClosure`.
2024-07-25 21:25:23 +08:00
Olaoluwa Osuntokun
9e2b308f93
build: update to Go 1.22.5 2024-07-24 14:21:13 -07:00
yyforyongyu
7e60d41898
chainfee: make sure web API has been started before estimating
Previously we may get a floor feerate when calling `EstimateFeePerKW`
due to the fee estimator not finishing its startup process, which gives
us an empty fee map.

This is now fixed to return an error if the estimator is not started.
2024-07-24 20:05:00 +08:00
yyforyongyu
0a0d51ce22
docs: update release notes 2024-07-24 20:05:00 +08:00
yyforyongyu
a1d71afde8
lntest: allow specifying min relay feerate in itest 2024-07-24 20:05:00 +08:00
yyforyongyu
ce43e4bab7
chainfee: allow specifying min relay feerate from API source
This commit adds a new expected field, `min_relay_feerate`, in the
response body returned from the API source, allowing the API to specify
a min relay feerate to be used instead of the FeePerKwFloor.

This change is backwards compatible as for an old API source which
doesn't specify the `min_relay_feerate`, it will be interpreted as zero.
2024-07-24 20:05:00 +08:00
Oliver Gugger
b10ebb2692
Merge pull request #8923 from yyforyongyu/fix-test-interface
chainntnfs+lntest: fix `TestInterfaces`
2024-07-24 05:57:07 -06:00
yyforyongyu
48a0efe40c
bitcoindnotify: add debug logs in unit test 2024-07-24 18:05:06 +08:00
yyforyongyu
9fee656d70
chainntnfs+lntest: fix TestInterfaces
This commit upgrades the test to always use a segwit v0 witness program
when creating testing txns.
2024-07-24 17:43:27 +08:00
Olaoluwa Osuntokun
6f37db3a92
Merge pull request #8927 from guggero/fix-release-script
GitHub: update vendored release script
2024-07-23 15:16:09 -07:00
Oliver Gugger
f27f9f2799
Merge pull request #8892 from lightningnetwork/yy-itest-miner
Beat [0/4]: improve itest miner
2024-07-23 12:12:36 -06:00
Oliver Gugger
0387a1edfb
mod: bump fn to v1.2.0
This fixes the Coverage CI step by making sure the file system is in
sync with the files pulled in through a Go submodule.
2024-07-23 20:02:47 +02:00
yyforyongyu
91807625bb
itest: fix testUnconfirmedChannelFunding for neutrino
This test was previously working because we'd mine an extra block to
confirm the coins inside `FundCoinsUnconfirmed` when it's a neutrino
backend, as shown in
fdd28c8d88/lntest/harness.go (L1431)
Since neutrino has trouble seeing unconfirmed balance, we now send some
coins to the wallet, confirm those, then do a self-transfer so the node
will have unconfirmed outputs to perform the test.
2024-07-23 21:53:51 +08:00
yyforyongyu
2d21aa3718
docs: update release notes 2024-07-23 21:30:09 +08:00
yyforyongyu
4dcce9df69
lntest+itest: fix flakes found using neutrino backend
This commit makes sure the sweep requests are received before mining
blocks to trigger the actual sweeping.

In addition, `testFundingExpiryBlocksOnPending` is updated to deal with
the old `channel link not found` issue.
2024-07-23 21:30:09 +08:00
yyforyongyu
2608c0893e
multi: make sure missionControlStore catches done signal
This commit makes sure `missionControlStore` catches the shutdown signal
when draining the ticker. A few debug logs are added to aid the process.
2024-07-23 21:30:08 +08:00
yyforyongyu
50279464ad
itest: remove unused param in chanRestoreViaRPC 2024-07-23 21:30:08 +08:00
yyforyongyu
623f816f8e
lntest: remove redundant nodes shutdown
The nodes are already shut down in the `Cleanup` in `ht.Subtest` so
there's no need to shutdown them again.
2024-07-23 21:30:08 +08:00
yyforyongyu
8240a87c2b
itest: fix misuse of MineBlocks and replace it with
`MineBlocksAndAssertNumTxes`
2024-07-23 21:30:08 +08:00
yyforyongyu
f1f341095e
lntest+itest: add new method CurrentHeight 2024-07-23 21:30:08 +08:00
yyforyongyu
14e7b134d9
lntest+itest: make Miner a private instance 2024-07-23 21:30:08 +08:00
yyforyongyu
be4dba5da6
lntest+itest: finalize moving miner methods 2024-07-23 21:30:07 +08:00
yyforyongyu
6bd8baea38
lntest+itest: continue removing direct call to Miner 2024-07-23 21:30:07 +08:00
yyforyongyu
976bb37972
lntest+itest: add method AssertNumTxsInMempool and AssertTxInBlock
in harness

Prepare to make `HarnessTest.Miner` a private instance to sync height.
2024-07-23 21:30:07 +08:00
yyforyongyu
e553895ddd
lntest+itest: strictly define the behavior of MineBlocks
This commit adds more assertion to `MineBlocks` so the caller won't
misuse it.
2024-07-23 21:30:07 +08:00
yyforyongyu
91b20e661b
lntest: move mining methods into one file 2024-07-23 21:30:07 +08:00
yyforyongyu
a881477404
lntest: create new package lntest/miner for itest miner
This commit moves the `HarnessMiner` into a new package to avoid
confusion about incoming changes.
2024-07-23 21:30:07 +08:00
Oliver Gugger
154a8af078
GitHub: update vendored release script
This fixes the problem where releases wouldn't be created anymore due to
the GitHub Action for creating the draft release being out of date.
2024-07-23 14:49:05 +02:00