Commit Graph

1126 Commits

Author SHA1 Message Date
ziggie
db2c50a599 channeldb: add context to query method
We add a context for the query method because the query method
is part of the paymentDB interface and for the SQL case
we will need the context for this method because the native
SQL drivers demand one. So we add it for the kv implementation
here as well so we can then make use of the new interface type.
2025-08-11 16:44:13 +02:00
Elle Mouton
8aa8c7cc42 multi: remove the NodeRTx interface type 2025-08-06 09:56:21 +02:00
Elle Mouton
5727bfa688 graph/db: let ForEachNodeCached maybe fetch node addresses
Here we adjust the ForEachNodeCached graph DB method to pass in a node's
addresses into the provided call-back if requested. This will allow us
to improve the performance of node/channel iteration in the autopilot
subserver.
2025-08-06 09:50:54 +02:00
ziggie
0aef5fa44c multi: unify all payment related kv data
All interactions related to the payment db are now part of the
kvPaymentDB struct.
2025-08-02 13:24:27 +02:00
MPins
3a7df1d7c8 rpcserver+invoices: add support for deleting canceled invoice
Adds server-side RPC functionality to delete canceled invoice,
support deleting specific canceled invoice from the database.
2025-07-25 21:21:51 -03:00
Oliver Gugger
6b1c85265f lnrpc+rpcserver: add QoL flag for permission check
To make it even more obvious that by default the permissions to check
aren't taken from the full method provided, we add a new flag that does
that on request.
2025-07-21 13:07:43 +02:00
Oliver Gugger
66340500e9 lnrpc+rpcserver: improve docs for CheckMacaroonPermissions
Fixes #10026.
2025-07-21 13:06:25 +02:00
Oliver Gugger
f5b27bf057 lnrpc+rpcserver: add missing channel update event type
Fixes the error "unexpected channel event update" in
SubscribeChannelEvents.
2025-07-15 17:12:17 +02:00
Elle Mouton
21ac7ef6f4 multi: add reset to ForEachNode 2025-07-15 11:25:09 +02:00
Elle Mouton
c32bf642d2 multi: pass reset to ForEachNodeCached 2025-07-15 11:23:27 +02:00
Elle Mouton
e5fbca8299 multi: let ForEachNodeChannel take a reset param 2025-07-15 11:23:27 +02:00
Elle Mouton
88261834e5 graph/db: expose reset in ForEachChannel
Add a `reset` call-back param to the V1Store ForEachChannel method.
2025-07-15 11:23:26 +02:00
Elle
add81f1388 Merge pull request #10064 from ellemouton/getChanInfoGrpcErr
rpcserver: return consistent grpc NotFound error for GetChaninfo & LookupInvoice
2025-07-14 08:34:46 +02:00
Oliver Gugger
8ee661f18f Merge pull request #10043 from ellemouton/ctx3
multi: add context.Context param to more graphdb.V1Store methods
2025-07-10 13:40:51 +02:00
Elle Mouton
23c3aaac6a rpcserver: catch extra err case in LookupInvoice
For a kvdb backed invoices DB, we sometimes will return the
ErrNoInviocesCreated error if no invoices have ever been created on the
node. In these cases we should still wrap the returned error in the grpc
NotFound code.
2025-07-10 11:21:37 +02:00
Torkel Rogstad
7a52b6ca5e rpcserver: return consistent grpc NotFound error for GetChaninfo
So that we can properly convert this NotFound error back to our
`graphdb.ErrEdgeNotFound` error if we are making this call to another
node via RPC.
2025-07-10 11:21:31 +02:00
Elle Mouton
ef181adbc8 rpcserver: fix race condition in graph cache eviction
The previous implementation of the graph cache evictor used
time.AfterFunc, which introduced a race condition. The closure
passed to AfterFunc could execute before the call returned and
assigned the timer to the r.graphCacheEvictor field.

This created a scenario where the closure would attempt to call
Reset() on a nil r.graphCacheEvictor, causing a panic.

This commit fixes the race by replacing time.AfterFunc with a
more robust pattern using time.NewTimer and a dedicated goroutine.
The new timer is created and assigned immediately, ensuring that
r.graphCacheEvictor is never nil when accessed.

The dedicated goroutine now safely manages the timer's lifecycle,
resetting it upon firing and stopping it gracefully upon server
shutdown, which also prevents goroutine leaks.
2025-07-09 11:56:09 +02:00
Elle Mouton
3d5e852c8c graph/db: let ForEachNodeCached take a context 2025-07-08 15:11:02 +02:00
Elle Mouton
1e804a3d5f graph/db: let ForEachNode take a context 2025-07-08 15:11:02 +02:00
Elle Mouton
046e106a17 graph/db: let ForEachChannel take a context 2025-07-08 15:10:30 +02:00
Elle Mouton
f8d3a3f3ba graph/db: let ForEachNodeChannel take a context 2025-07-08 15:10:30 +02:00
yyforyongyu
650e72518c rpcserver: remove duplicate info from RoutingPolicy
We remove the inbound fee record from `RoutingPolicy.CustomRecords` as
we already have fields `InboundFeeBaseMsat` and `InboundFeeRateMilliMsat`.
2025-07-01 19:59:50 +08:00
Elle
e8213dbc44 Merge pull request #9752 from erickcestari/reject-payment-without-invoice
routerrpc: reject payment to invoice that don't have payment secret or blinded paths
2025-06-30 13:11:36 +02:00
ziggie
24e3958a0b lnd: improve code comment 2025-06-25 13:50:18 +02:00
Erick Cestari
c01a66783f routerrpc: inject clock for testable expiry validation
Refactors payment request expiry validation to use an injected clock
dependency instead of calling time.Now() directly.
2025-06-20 09:23:02 -03:00
Boris Nagaev
7a70dcb36e lnrpc: add auth_proof to graph APIs
Added flag include_auth_proof to DescribeGraph, GetNodeInfo, GetChanInfo
and the corresponding lncli commands. With the flag, these APIs add AuthProof
(signatures from the channel announcement) to the returned ChannelEdge.

This is useful to extract this data from the DB.
2025-06-19 18:19:33 -03:00
Elle Mouton
91513623b5 routing: remove a context.TODO() 2025-06-19 14:49:32 +02:00
Elle Mouton
004440a86c graph/db: thread context through to LookupAlias 2025-06-19 14:49:32 +02:00
Elle Mouton
7ba4051cfd graph/db: thread context through to SourceNode 2025-06-19 14:47:41 +02:00
Elle Mouton
e724e1c3e4 multi: thread context through to AddrsForNode 2025-06-17 19:20:59 +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
Shivam Chawla
bfe1edf4ec lnrpc: add filters to forwardhistoryrequest
This commit adds incoming and outgoing channel ids filter to forwarding history request to filter events received/forwarded from/to a particular channel
2025-06-11 09:10:13 +05:30
Elle Mouton
bf72d9ec19 graph+rpcserver: add InboundFee to ChannelEdgeUpdate
And then use that new field instead of parsing from extra opaque data.
2025-06-09 08:32:15 +02:00
Elle Mouton
e170ad44d9 graph/db+rpcserver: remove inbound fee extraction
For any call-site where we extract inbound fees from a
models.ChannelEdgePolicy object that was deserialised from disk, we can
now just use the new InboundFee field on the object since we know that
it would have been populated at deserialisation time.

Note that for all these call-sites, if a failure previously happened on
decoding of the TLV stream, the error would be ignored and the edge
would just be skipped. This behaviour is now still the same given how
ErrParsingExtraTLVBytes is handled on the DB layer.
2025-06-09 08:28:50 +02:00
Abdullahi Yunus
a0634e4ade lnd+lnrpc: update fwdinghistory message
In this commit we update the returned message for fwdinghistory
to include the htlcindex for all forwarded htlcs.
2025-06-06 12:21:46 +01: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
da3deeee7c multi: remove kvdb.RTx from ForEachNodeChannel
Since we have not removed all call-sites that make use of this
parameter, we can remove it. This helps hide DB-specific details from
the interface we will introduce for the graph store.
2025-05-22 14:14:39 +02:00
Elle Mouton
1c6c6436af autopilot: continue threading context
Remove one context.TODO and add one more.
2025-05-22 14:14:38 +02:00
Elle Mouton
13fcb08794 autopilot: start threading contexts through
The `GraphSource` interface in the `autopilot` package is directly
implemented by the `graphdb.KVStore` and so we will eventually thread
contexts through to this interface. So in this commit, we start updating
the autopilot system to thread contexts through in preparation for
passing the context through to any calls made to the GraphSource.

Two context.TODOs are added here which will be addressed in follow up
commits.
2025-05-22 14:14:38 +02:00
MPins
7a604c8d00 rpcserver: validate blindCfg.MaxNumPaths
Assert that the blindCfg.MaxNumPaths value is non-zero.
2025-05-13 19:42:53 -03:00
MPins
85c92805e9 rpcserver: start reading incoming blinded chan chain
Adds support for specifying a blinded path in addinvoice using
a list of chained incoming channels.
2025-05-13 17:02:43 -03:00
yyforyongyu
ab2361b8fb lnd: log lockedBalance in WalletBalance 2025-04-17 09:32:29 +08:00
András Bánki-Horváth
b6cf1bcaa0 Merge pull request #9630 from xinhangzhou/master
refactor: use maps.Copy for cleaner map handling
2025-03-28 07:54:34 +01:00
Oliver Gugger
82b7891e2d rpcserver: add custom channel data to pending channels
The pending force close and pending waiting close channels didn't have
their custom channel data populated yet.
2025-03-27 12:38:49 -05:00
Oliver Gugger
bab5cabd90 lnrpc+rpcserver: add custom channel data for closed channels
This commit adds the custom channel data for closed channels which
represents the initial funding state as well as the final balances at
closing time.
2025-03-27 12:38:47 -05:00
yyforyongyu
43409c7840 rpcserver: use HtlcIndex as the unique key 2025-03-26 18:24:47 +08:00
yyforyongyu
70dec8e169 lnd: log sync status in GetInfo
This is added to fix a flake found in starting the node.
2025-03-26 18:24:47 +08:00
Oliver Gugger
44161a3643 Merge pull request #9631 from hieblmi/degrade-err
rpcserver: warn if sendcoins default conf target is used
2025-03-25 08:09:11 -06:00
xinhangzhou
b7e3c20383 refactor: use maps.Copy for cleaner map handling
Signed-off-by: xinhangzhou <shuangcui@aliyun.com>
2025-03-25 01:19:55 +08:00