Commit Graph

1275 Commits

Author SHA1 Message Date
ziggie
46500f94e0 multi: fix comment of InitPayment method 2025-08-20 09:07:51 +02:00
ziggie
9f824fe1ee multi: introduce interface for payment database 2025-08-20 09:07:48 +02:00
ziggie
2b856f036e multi: fix linter 2025-08-14 19:53:18 +02:00
ziggie
df9bac2ecf multi: move PaymentCreationInfo to payment pkg 2025-08-14 19:53:18 +02:00
ziggie
d138e23919 multi: move FailureReason to payment package 2025-08-14 19:53:18 +02:00
ziggie
03af9858d2 multi: move payment related code into own package
This commit moves most of the code into its own package. It is
the smallest code move possible without moving import cycles and
keeping the changes to the code base as small as possible during
refactor.
2025-08-14 19:53:15 +02:00
Yong
c6a9116e3a Merge pull request #9844 from ziggie1984/refactor-payments-code-03
Refactor Payment PR 3
2025-08-13 06:05:01 -04:00
ziggie
88da582526 mulit: use kvdb.Backend for the kv payment db
Instead of the ChannelState struct we now use the kv backend
interface for the payment kv database.
2025-08-11 16:44:14 +02:00
ziggie
18afd4442d multi: introduce new paymentsDB package
We introduce a new package paymentsDB and start by moving the
payment specifc errors from the channeldb package to the
paymentsDB package. We also fix linter issues which showed up
due to changing this code part.
2025-08-11 16:44:14 +02:00
ziggie
79e1cf0db7 routing: make sure attempts are always resolved after a timeout
We check the context of the payment lifecycle at the beginning of
the `resumepayment` loop. This will make sure we have always the
latest state of the payment before deciding on the next steps in
the function `decideNextStep`.
2025-08-08 09:23:07 +02:00
ziggie
e2a9b17254 multi: skip range check in pathfinder and switch for custom htlc payments 2025-08-06 09:37:08 +02:00
ziggie
2d07d44d1a channeldb: rename PaymentControl struct
In the following commits we will gradually unify the current
payment db operations into an interface to later down the road
support both backends (sql+kv).
2025-08-02 11:24:59 +02:00
Elle Mouton
83f6dc4983 multi: reset for ForEachNodeDirectedChannel 2025-07-15 11:25:10 +02:00
Elle Mouton
b3f3766fe6 multi: pass reset to GraphSession 2025-07-15 11:25:09 +02:00
Elle Mouton
e5fbca8299 multi: let ForEachNodeChannel take a reset param 2025-07-15 11:23:27 +02:00
Elle Mouton
85fda8b926 routing+server: let ForAllOutgoingChannels take a context
And so, remove a previously added context.TODO
2025-07-08 15:10:30 +02:00
ziggie
eb4c87cdcb routing: return error for getBandwidth and log it 2025-07-08 11:41:15 +02:00
ziggie
9a75400295 multi: add logs to debug potential payment sending issue 2025-07-08 10:54:59 +02:00
Oliver Gugger
8a03414190 Merge pull request #10017 from ellemouton/strictTypeForChanFeatures
refactor+multi: use *lnwire.FeatureVector for ChannelEdgeInfo features
2025-07-02 19:59:47 +02:00
George Tsagkarelis
4ad84627e1 htlcswitch+routing: PaymentBandwidth accepts channel peer pubkey argument 2025-07-02 12:09:24 +02:00
George Tsagkarelis
1793b1ab64 routing+htlcswitch: ProduceHtlcExtraData uses first hop pub key 2025-07-02 12:03:34 +02:00
Elle Mouton
2f2845dfc0 refactor+multi: use *lnwire.FeatureVector for ChannelEdgeInfo features
In this commit, we move the serialisation details of a channel's
features to the DB layer and change the `models` field to instead use a
more useful `*lnwire.FeatureVector` type.

This makes the features easier to work with and moves the serialisation
to where it is actually used.
2025-07-01 17:02:07 +02:00
Elle Mouton
8cf567b948 multi: use the "errors" package everywhere
Replace all usages of the "github.com/go-errors/errors" and
"github.com/pkg/errors" packages with the standard lib's "errors"
package. This ensures that error wrapping and `errors.Is` checks will
work as expected.
2025-06-30 09:46:55 +02:00
Elle Mouton
3ccaacd16f multi: rename MakeTestGraphNew to MakeTestGraph 2025-06-26 10:12:30 +02:00
Oliver Gugger
fb1fef9e6c Merge pull request #9971 from ellemouton/graphSQL16-closed-scids
[16] graph/db: SQL closed SCIDs table and last few methods
2025-06-25 17:32:49 +02:00
Elle Mouton
34cb6a9f27 graph/db: impl GraphSession 2025-06-25 13:26:52 +02:00
Elle Mouton
6475787750 routing: fix log line formatting 2025-06-25 12:57:30 +02:00
Elle Mouton
4945bd42fa routing: expand routeblinding path finding tests
Cover more cases for the incoming chained channel feature.
2025-06-25 12:57:28 +02:00
Elle Mouton
34154802f3 routing+itest: fix route blinding path selection bug
Here we fix a bug which would not include the selected incoming blinded
path chain from being included in the selected path set if it meets the
minimum length requirement. The appropriate unit test and itest is
updated to demonstrate the fix.
2025-06-25 12:55:36 +02:00
Elle Mouton
067e316df8 routing: clean-up the tests a bit
This is just in preparation for the next commit. The test will be
cleaned up more after a bug is fixed.
2025-06-25 12:49:51 +02:00
Elle Mouton
4bc0aee35b routing: improve TestFindBlindedPaths readability
Add a helper so that we can refer to channels by using the aliases of
the nodes that own the channel instead of needing to use the raw channel
ID.
2025-06-25 12:33:01 +02:00
Elle Mouton
da37fe20fc routing: add comments and clean-up to findBlindedPaths
Here we add some more comments and a bit of code clean up to the
`findBlindedPaths` function. No logic is changed here.
2025-06-25 12:33:00 +02:00
Elle Mouton
91513623b5 routing: remove a context.TODO() 2025-06-19 14:49:32 +02:00
Elle Mouton
81c063eb96 graph/db: thread context through to UpdateEdgePolicy 2025-06-19 14:49:31 +02:00
Elle Mouton
3fdb9b84f4 graph/db: thread context to AddChannelEdge 2025-06-19 14:47:41 +02:00
Elle Mouton
7ba4051cfd graph/db: thread context through to SourceNode 2025-06-19 14:47:41 +02:00
Elle Mouton
65049ddd02 graph/db: thread context through to SetSourceNode 2025-06-19 14:47:40 +02:00
Elle Mouton
dc6259fcc3 graph/db: thread context through to HasLightningNode 2025-06-17 19:20:56 +02:00
Elle Mouton
66c5a97202 graph/db: thread context through to FetchLightingNode 2025-06-17 19:20:27 +02:00
Elle Mouton
d1cfb47428 graph/db: thread context to AddLightningNode 2025-06-17 19:20:27 +02:00
ziggie
fe3db6a263 multi: update sphinx lib to latest version 2025-06-13 08:47:31 +02:00
Elle Mouton
f95588caca graph/db: add CachedEdgePolicy helpers 2025-06-10 20:10:35 +02:00
Elle Mouton
cb16c7177a graph/db: use InboundFee directly from ChannelEdgePolicy
Now that we know that the InboundFee on the ChannelEdgePolicy is always
set appropriately, we can update the GraphCache UpdatePolicy method to
take the InboundFee directly from the ChannelEdgePolicy object.
2025-06-09 08:31:19 +02:00
Elle Mouton
9890d74622 multi: set the InboundFee on ChannelEdgePolicy
In this commit, we make sure to set the new field wherever appropriate.
This will be any place where the ChannelEdgePolicy is constructed other
than its disk deserialisation.
2025-06-09 08:31:10 +02:00
Oliver Gugger
fc906f2a65 Merge pull request #9127 from MPins/issue-8993
Add the option on path creator to specify the incoming channel on blinded path
2025-06-05 08:47:05 +02:00
Elle Mouton
dc353dc50e multi: use MakeTestGraph everywhere for test graph creation
In this commit, we unify how all unit tests that make use of the graph
create their test ChannelGraph instance. This will make it easier to
ensure that once we plug in different graph DB implementations, that all
unit tests are run against all variants of the graph DB.

With this commit, `NewChannelGraph` is mainly only called via
`MakeTestGraph` for all tests _except_ for `TestGraphLoading` which
needs to be able to reload a ChannelGraph with the same backend. This
will be addressed in a follow-up commit once more helpers are defined.

Note that in all previous packages where we created a test graph using
`kvdb.GetBoltBackend`, we now need to add a `TestMain` function with a
call to `kvdb.RunTest` since the `MakeTestGraph` helper uses
`GetTestBackend` instead of `kvdb.GetBoltBackend` which requires an
embedded postgres instance to be running.
2025-05-22 14:14:42 +02:00
Elle Mouton
7288f280f6 routing+autopilot: rename mission control store var
To clearly separate the mission control DB store (which for now will
remain kvdb only) from the graph store, we rename the `graphBackend`
variable to `mcBackend` in the `testGraphInstance` struct.
2025-05-22 14:14:41 +02:00
Elle Mouton
526fb7f181 graph/db: init KVStore outside of ChannelGraph
So that we can pass in the abstract V1Store in preparation for adding a
SQL implementation of the KVStore.
2025-05-22 14:14:40 +02:00
MPins
ec42b9acd0 routing: add logging for routes discarded due to low success probability
Create the ChanIDString function to return a string representation
of the route's channel IDs, formatting them in the order they appear
in the route (e.g., "chanID1 -> chanID2").

Discarded routes with a success probability lower than the minimum
threshold are now logged accordingly when finding a blinded path.
2025-05-13 19:42:36 -03:00
MPins
f541c442cf routing: add incoming channel chain to blinded paths
In this commit, the blindedPathRestrictions are expanded to include a
list of incoming channels that must be included in any blinded path. The
unit tests are expanded to test this new logic.
2025-05-13 17:02:43 -03:00