Commit Graph

1163 Commits

Author SHA1 Message Date
Elle Mouton
ab7aae0708
multi: rename nolint:lll to nolint:ll
Find and replace all nolint instances refering to the `lll` linter and
replace with `ll` which is the name of our custom version of the `lll`
linter which can be used to ignore log lines during linting.

The next commit will do the configuration of the custom linter and
disable the default one.
2024-12-02 09:14:21 +02:00
Elle Mouton
439a6c7d6c
multi: rename chan DB Open method to OpenForTesting 2024-11-28 13:51:15 +02:00
Elle Mouton
4089fbcb44
multi: fix linter errors 2024-11-28 13:51:15 +02:00
Elle Mouton
adcaa8802f
multi: remove kvdb.Tx from ChannelGraphSource.ForAllOutgoingChannels
and the same for ChannelStateDB.FetchChannel. Most of the calls to these
methods provide a `nil` Tx anyways. The only place that currently
provides a non-nil tx is in the `localchans.Manager`. It takes the
transaction provided to the `ForAllOutgoingChannels` callback and passes
it to it's `updateEdge` method. Note, however, that the
`ForAllOutgoingChannels` call is a call to the graph db and the call to
`updateEdge` is a call to the `ChannelStateDB`. There is no reason that
these two calls need to happen under the same transaction as they are
reading from two completely disjoint databases. And so in the effort to
completely split untangle the relationship between the two databases, we
now dont use the same transaction for these two calls.
2024-11-28 13:49:41 +02:00
Elle Mouton
6e13898981
multi: move LightningNode struct to models package 2024-11-28 13:36:32 +02:00
Elle Mouton
1859993734
channeldb+graphdb: init graph DB outside of channel db
We also now use the graph DB's own optional functions. An instance of
the graph is currently still passed to the channeldb's
`CreateWithBackend` function. This will be removed in a later commit
once the two have been completely disjoint.
2024-11-28 13:36:15 +02:00
Elle Mouton
74a4b1922b
refactor: move graph related DB code to graph/db from channeldb
This is a pure refactor commit. It moves over all the graph related CRUD
code from `channeldb` to `graph/db`.
2024-11-28 13:36:13 +02:00
Elle Mouton
9f54ec90aa
multi+refactor: move models package to graph/db
All the structs defined in the `channeldb/models` package are graph
related. So once we move all the graph CRUD code to the graph package,
it makes sense to have the schema structs there too. So this just moves
the `models` package over to `graph/db/models`.
2024-11-28 13:34:33 +02:00
Elle Mouton
c2923e2214
multi: remove PrefixLog
And instead use the new btclog Logger `WithPrefix` method.
2024-11-27 10:44:32 +02:00
Oliver Gugger
38ec1a1c64
Merge pull request #8805 from breez/jssdwt-insert-edge-when-not-found
localchans: recreate missing edge if not found
2024-11-22 08:42:51 +01:00
Jesse de Wit
266531271b
localchans: do error if an edge policy is missing 2024-11-21 10:57:54 +01:00
Jesse de Wit
7d9d100e94
localchans: add policy when missing 2024-11-14 11:42:22 +01:00
yyforyongyu
523ecc0653
multi: wait for rpcclients shutdown to complete
We need to call `WaitForShutdown` after stopping the rpc clients of the
chain backends.
2024-11-14 01:22:31 +08:00
Jesse de Wit
5e5291d044
localchans: add test for createEdge and manager 2024-11-13 12:13:11 +01:00
Jesse de Wit
bb4d3db8bc
localchans: recreate missing edge if not found
If a node contains a channel, but doesn't have a corresponding edge in
the graph database, updating the channel policy would fail. In this
commit the edge is recreated if the channel exists. This ensures a node
can recover from a missing edge in the graph database by calling
updatechanpolicy.
2024-11-13 12:13:11 +01:00
yyforyongyu
227cc3a45c
routing: fix missionControlStore blocks on shutting down 2024-11-08 01:23:33 +08:00
Elle Mouton
5370c90906
routing+migration32: update MC encoding to use pure TLV
In this commit, we update an existing migration which at the time of
writing has not been included in a release. We update it so that it
converts the format used for MissionControl result encoding to use pure
TLV instead. The 3 structs that have been updated are: `mcHop`,
`mcRoute` and `paymentResult`.
2024-11-01 12:28:06 +02:00
Elle Mouton
d9a073ad7e
routing+channeldb: let Vertex implement tlv.RecordProducer
So that we can use it in TLV encoding.
Also add this to the codec for channeldb migration 32 since we will be
using it there in an upcoming adjustment commit.
2024-11-01 08:59:54 +02:00
Elle Mouton
9d0cd3ff4f
multi: update more loggers to the v2 type 2024-10-22 17:03:56 +02:00
Elle Mouton
23602e017e
multi: start updating various loggers to use the new v2 type 2024-10-22 17:03:55 +02:00
Olaoluwa Osuntokun
2d333178c3
Merge pull request #8960 from lightningnetwork/0-19-staging-rebased
[custom channels 5/5]: merge custom channel staging branch into master
2024-10-03 10:07:16 -07:00
George Tsagkarelis
d1a2dd6bd0
routing: add htlcAmt to PaymentBandwidth method of TlvTrafficShaper
This commit was added to the 0-19-staging branch recently and therefore
didn't make it into a previous part yet. So it's unrelated to the
changes in this part but is required for the whole custom channel saga.
2024-10-02 18:09:46 -07:00
Elle Mouton
8126930d6c
routing: support multiple namespaced MissionControls 2024-10-01 14:11:05 +02:00
Elle Mouton
5eff056933
routing: prefix MC logs with namespace 2024-10-01 14:06:54 +02:00
Elle Mouton
f0f4f2df21
routing: separate MissionControl from MissionControlManager
This commit renames the previous MissionControl to MissionController and
the previous MissionController interface to MissionControlQuerier. This
is done because soon the (new) MissionController will back multiple
namespaced MissionControl instances.  For now, it just houses a single
MissionControl in the default namespace.

This commit also replaces the MissionControl's `now` function with a
`clock.Clock`.
2024-10-01 14:06:50 +02:00
Elle Mouton
28a828a11e
routing: unexport MissionControl mutex
Only the MissionControl instance should use this variable and it should
not be accessible to users of MissionControl.
2024-10-01 13:50:50 +02:00
Elle Mouton
6b449a6633
routing: start writing and reading from namespaced MC
and invoke the associated mission control migration.
2024-10-01 13:50:50 +02:00
Elle Mouton
2dd9046622
routing: introduce missionControlDB abstraction
So that `missionControlStore` can be unaware of the backing DB structure
it is writing to. In an upcoming commit when we change mission control
to write to namespaced buckets instead, we then only need to update the
`namespacedDB` implementation.
2024-10-01 13:50:50 +02:00
Elle Mouton
383a6d274f
routing+channeldb: migrate MC store to use minimal Route encoding
Add a new mcRoute type that houses the data about a route that MC
actually uses. Then add a migration (channeldb/migration32) that
migrates the existing store from its current serialisation to the new,
more minimal serialisation.
2024-09-30 11:40:25 +02:00
Elle Mouton
7dc86acb8c
multi: update PaymentAddr to use fn.Option
Since it is allowed to not be set and so can lead to nil deref panics if
it is a pointer.
2024-09-25 11:14:35 +09:00
Elle Mouton
7bbf89625f
multi: move ChannelUpdate validate methods to netann 2024-09-18 16:13:18 +02:00
Elle Mouton
60f331edb1
multi: rename ChannelUpdate to ChannelUpdate1
In preparation for adding a new ChannelUpdate2 message and a
ChannelUpdate interface, we rename the existing message to
ChannelUpdate1.
2024-09-18 16:13:17 +02:00
Matt Morehouse
8373cca43c
routing: skip fuzzing when capacity is 0
probabilityFormula() is expected to return an error if capacity is 0, so
we should exclude that case from fuzzing.

Previously it was attempted to avoid this case by seeding the corpus
with an input that had capacity 1. That is not an effective solution
since the fuzzer can still generate an input with capacity 0.
2024-09-10 15:17:39 -05:00
Oliver Gugger
a895b1c6ca
Merge pull request #9051 from calvinrzachman/export-routing-interface
routing: export dbMPPayment interface
2024-09-09 05:15:38 -06:00
George Tsagkarelis
aa17543d23
routing: use first hop records on path finding 2024-09-05 18:00:53 +02:00
Oliver Gugger
4804cbf139
channeldb+routing: persist first hop custom data for route 2024-09-05 18:00:53 +02:00
Olaoluwa Osuntokun
f04fa54622
routing: skip amtInRange for custom HTLCs
We might be trying to send an invoice amount that's greater than the size of the channel, but once you factor in the custom channel logic, an actual HTLC can be sent over the channel to pay that larger payment.

As a result, we'll skip over this check if a have a custom HTLC.
2024-09-05 18:00:52 +02:00
George Tsagkarelis
5b4de5f0d4
routing: add TlvTrafficShaper to bandwidth hints 2024-09-05 18:00:52 +02:00
Oliver Gugger
1b31835230
channeldb+routing: persist first hop custom records
With this commit we make sure the first hop custom records aren't lost
on restart/resume of a payment, so we persist it as part of the
PaymentCreationInfo struct.
2024-09-05 11:18:16 +02:00
George Tsagkarelis
42e358e3d3
lnrpc: add wire records fields to payment+interceptor RPCs 2024-09-05 11:18:16 +02:00
George Tsagkarelis
878f964a33
multi: use wire records on payment and intercept flows 2024-09-05 11:18:16 +02:00
Calvin Zachman
7547c234cc
routing: export dbMPPayment interface
This will assist external programs attempting to re-use
ChannelRouter code and leverage the ControlTower's FetchPayment
method.
2024-08-27 19:00:58 -05:00
ziggie
25f7b1c362
blindedpath: minHTLC for blinded path change.
We will not add a buffer to the chan policy for blinded paths in case
the sender amount violates the minHTLC restriction in the first place.

Moreover we disgard a route fast if the payment amount is smaller than
the minHTLC along the route.
2024-08-22 19:09:43 +02:00
ziggie
73984964a8
blindedpath: fix log output. 2024-08-22 17:48:27 +02:00
ziggie
5d7113ac1d
blindedpath: remove blockexpiry check.
Removes a check where we would NOT allow to create a blinded invoice
with an expiry (invoice expiry in seconds considered as block time)
lower than the min_final_ctlv_delta.
2024-08-22 17:45:45 +02:00
MPins
de495534e4 routing: Call the function to update routing config on main cfg
NewMissionControl propagate the callback function defined on server.go and
SetConfig call it to update the infos on main cfg.
2024-08-14 14:42:49 -03:00
Elle Mouton
ab28cde240
routing: correct initial finalPaddedSize
This purely affects logging. This makes sure that the `padStat`
finalPaddedSize field is initilised correctly with the given minSize.
2024-08-08 16:46:04 +02:00
Olaoluwa Osuntokun
459ee9b245
Merge pull request #8976 from ellemouton/rb-follow-ups
route blinding: follow ups
2024-08-07 17:54:31 -07:00
Elle Mouton
697f514d09
blindedpath: log chosen blinded paths
In this commit, we log selected blinded paths.
2024-08-07 17:03:12 +02:00
Elle Mouton
e4619afc08
multi: add node omission list for blinded paths 2024-08-07 17:03:11 +02:00