Commit graph

1286 commits

Author SHA1 Message Date
ziggie
2d477d699d
routing: allow misson control manager to startup despite errors
We now allow the mission control manager to skip over deserializable
errors. We cannot repair this these results but we just skip over
it so we can startup properly.

When fetchAll() encounters entries that fail to deserialize, in
addition to skipping them, now also:

- Delete the corrupted entries from the database
- Remove them from the in-memory keysMap and keys tracking structures

This prevents corrupted entries from:
- Being counted toward maxRecords, which would cause valid entries
  to be pruned prematurely
- Persisting in the database indefinitely
- Causing inaccurate entry counts in startup logs
2025-12-02 20:47:50 +01:00
Olaoluwa Osuntokun
2cc4079a0e
routing+htlcswitch+discovery+peer+netann: optimize debug logging with lazy evaluation
In this commit, we update the network and routing layer components to use
lnutils.SpewLogClosure for debug logging.
2025-09-05 18:20:51 -07:00
Elle Mouton
330f697937
graph: rename HasLightningNode
to HasNode
2025-09-03 10:14:35 +02:00
Elle Mouton
cd3bd05810
multi: rename FetchLightningNode
to FetchNode
2025-09-03 10:14:35 +02:00
Elle Mouton
060219780b
multi: rename AddLightningNode methods
to AddNode
2025-09-03 10:14:35 +02:00
Elle Mouton
c663a557c4
multi: rename models.LightningNode to models.Node 2025-09-03 10:14:35 +02:00
Boris Nagaev
dee8ad3754
multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings.

This change was produced by:
 - running golangci-lint run --fix
 - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go`
 - manually fixing broken tests
 - itest, lntest: use ht.Context() where ht or hn is available
 - in HarnessNode.Stop() we keep using context.Background(), because it is
   called from a cleanup handler in which t.Context() is canceled already.
2025-08-30 14:13:44 -03:00
ziggie
bf6131ba02
routing: Add comment to DeleteFailedAttempts func call 2025-08-20 09:08:19 +02:00
ziggie
039b5994f3
routing: add more comments to the ControlTower interface 2025-08-20 09:08:19 +02:00
ziggie
b16782caeb
multi: move DBMPPayment to paymentsdb package 2025-08-20 09:08:19 +02:00
ziggie
82242f5342
multi: rename KVPaymentDB to KVStore
This matches the same naming as used in the graph package.
2025-08-20 09:07:53 +02:00
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