Commit Graph

19170 Commits

Author SHA1 Message Date
Erick Cestari
118e0a99c1 routerrpc: reject invoices missing secret/path
Ensure that a payment is only sent if the invoice includes either a
payment address (payment secret) or at least one blinded path.
2025-06-20 09:23:09 -03: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
Oliver Gugger
7857d2c6ae Merge pull request #9969 from ellemouton/fixLnwireTestDataRace
lnwire: fix test data race
2025-06-20 13:47:41 +02:00
Elle Mouton
667e0aadc3 lnwire: fix test data race
Ensure that tests can run in parallel without causing a data race by
adding a `makeTestChannelUpdate` constructor rather than sharing the
same `testChannelUpdate` type between tests. This is needed since some
tests write to the type.
2025-06-20 12:22:59 +02:00
Oliver Gugger
5e9e1826c6 Merge pull request #9965 from ellemouton/checkNilPolicy
graph/db: do nil check on ChannelEdgePolicy
2025-06-20 10:55:07 +02:00
Elle Mouton
5b0a9501ad graph/db: remove ChannelEdgePolicy nil warning logs
Since it is not a bug for us to not yet have the policy info for a
channel, we can remove these potentially spammy log lines.
2025-06-20 09:07:38 +02:00
Elle Mouton
b5bc9c8fbe graph/db: check for nil policies
In the graph/db code, we should always expect to deal with potentially
nil ChannelEdgePolicy pointers and so we should always do a nil check
before making use of the struct.
2025-06-20 09:07:37 +02:00
Yong
a3209a5bfa Merge pull request #9950 from starius/describegraph-authproofs2
lnrpc: add auth_proof to graph APIs
2025-06-20 14:54:03 +08:00
Boris Nagaev
409bf3c6cc docs: update release notes (include_auth_proof) 2025-06-19 18:19:33 -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
Oliver Gugger
40efefeb6a Merge pull request #9959 from ellemouton/chanGraphContext2
multi: add context.Context param to more graphdb.V1Store methods
2025-06-19 16:42:55 +02:00
Elle Mouton
91513623b5 routing: remove a context.TODO() 2025-06-19 14:49:32 +02:00
Elle Mouton
9597f01ce3 graph/db: thread context through to HighestChanID 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
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
yyforyongyu
e47091063a config: update docs for num-restricted-slots 2025-06-19 20:29:38 +08:00
yyforyongyu
250a61af6d lnd: remove peer from peerChanInfo when necessary
We now remove the peer from `peerChanInfo` if this peer doesn't have
channels with us. Also patched a unit test for `removePeerAccess`.
2025-06-19 20:23:46 +08:00
yyforyongyu
32d8e2123d channeldb+lnd: rename peerCounts to peerChanInfo for clarity 2025-06-19 16:48:13 +08:00
Oliver Gugger
e0a9705d59 Merge pull request #9935 from ellemouton/graphSQL11-forEachMethods
[11] graph/db: Implement various "ForEach" methods on the graph SQLStore
2025-06-19 10:29:42 +02:00
yyforyongyu
03de0f9e4b funding+lnd: make sure accessman won't interrupt funding flow
If there's an error occured when updating the peer's status after the
channel status is changed, we now make sure we log the error instead of
letting it interrupt the channel open/close flow.
2025-06-19 16:05:59 +08:00
yyforyongyu
0dc10ba692 accessman+lnd: rename checkIncomingConnBanScore for clarity 2025-06-19 16:05:59 +08:00
yyforyongyu
869e541b7c docs: add release notes for improved accessman 2025-06-19 16:05:59 +08:00
yyforyongyu
9caa5f220d itest+lntest: add more itest for accessman 2025-06-19 16:05:59 +08:00
yyforyongyu
e003cb5d4a accessman: make sure to decrement PendingOpenCount 2025-06-19 16:05:56 +08:00
Olaoluwa Osuntokun
168d63ce37 Merge pull request #9528 from Roasbeef/res-opt
fn: implement ResultOpt type for operations with optional values
2025-06-18 18:22:11 -07:00
Olaoluwa Osuntokun (aider)
0c25bd3f19 fn: implement ResultOpt type for operations with optional values
This commit introduces the ResultOpt type, which represents an operation
that can either succeed with an optional final value or fail with an
error.

The .gitignore file is also updated to exclude specific files related to
the `aider` tool.
2025-06-18 18:16:24 -07:00
Elle Mouton
ece157b40b graph/db: implement ForEachNodeChannel
Which lets us then run `TestIncompleteChannelPolicies` and
`BenchmarkForEachChannel` against our SQL backends.
2025-06-18 16:55:00 +02:00
Elle Mouton
0607982886 graph/db: implement ForEachNodeDirectedChannel and ForEachNodeCacheable
Here we add the `ForEachNodeDirectedChannel` and `ForEachNodeCacheable`
SQLStore implementations which then lets us run
`TestGraphTraversalCacheable` and `TestGraphCacheForEachNodeChannel`
against SQL backends.
2025-06-18 16:55:00 +02:00
Elle Mouton
8af32951c7 graph/db+sqldb: implement ForEachNode
In this commit the `ForEachNode` method is added to the SQLStore. With
this, the `TestGraphCacheTraversal` unit test can be run against SQL
backends.
2025-06-18 16:54:59 +02:00
Elle Mouton
d60761f79c graph/db: fix error check in test
An error in TestChanUpdatesInHorizon was previously not checked
correctly.
2025-06-18 15:24:16 +02:00
Elle Mouton
973d211083 graph/db: fix DecodeHexColor
Ensure that it does a sanity check on the length of its input and also
only call it if the nullable SQL string is not null.

Expand an existing unit tests to cover the DecodeHexColor such that it
would have caught the bug.
2025-06-18 15:19:23 +02:00
Elle Mouton
23d4bfc1b0 graph/db: add comment and switch to length check
Use a length check to determine if a bitcoin signature has been set or
not. Also add a clarifying comment to explain why we only need to check
if one signature field is set to determine if we have the auth proof for
the channel or not.
2025-06-18 15:17:55 +02:00
Oliver Gugger
31c74f20fa Merge pull request #9962 from yyforyongyu/fix-panic
chainio: use package logger instead of instance logger
2025-06-18 15:09:07 +02:00
Oliver Gugger
79294dff35 Merge pull request #9931 from ellemouton/graphSQL10-forEachSourceNode
[10] graph/db+sqldb: implement ForEachSourceNodeChannel
2025-06-18 14:51:38 +02:00
yyforyongyu
b0aa4ae2de chainio: use package logger instead of instance logger
There's no guarantee that the `b.beat` is initialized when the
dispatcher shuts down, especially with the case in the remote signer
where no chainbackend is created.
2025-06-18 19:43:27 +08:00
yyforyongyu
856ec463ff accessman: skip incrementing num of slots for existing peer
When a peer is already existing, we should skip incrementing the
`numRestricted` count.

Also patched unit test for method `addPeerAccess`.
2025-06-18 17:19:10 +08:00
yyforyongyu
0f9332b1d6 lnd: add string representation for peerAccessStatus 2025-06-18 17:19:10 +08:00
yyforyongyu
0c5bb49561 lnd: only restrict slots for inbound connections
For outbound connections, since they are initialized by the users, we
can relax on the restriction. A future global limit may be added - as
for now, we will let them to be managed by the users.
2025-06-18 17:19:10 +08:00
yyforyongyu
00db8c6359 lnd: move peer perms assignment into peerConnected
When the callback is called in `scheduledPeerConnection`, it is
referencing the old `access` variable which was created when the peer
was first connected. However, if this peer opens a channel with us and
goes offline, or another inbound connection is made from this peer, we
may still use the old `access` value. To fix it, we need to make sure we
always get the fresh perm by calling `assignPeerPerms` inside
`peerConnected`.
2025-06-18 17:19:10 +08:00
yyforyongyu
d8d468f459 accessman: reduce lock span by excluding ctx 2025-06-18 17:19:10 +08:00
yyforyongyu
124aabcdb7 accessman+lnd: check if a peer is found in peerScores
We need to also check this map to make sure the peer exists or not.
2025-06-18 17:19:09 +08:00
yyforyongyu
836b527a4e accessman: skip restriction for existing peers
When a peer already has a connection with us, there's no need to check
for available slots as we will either close the old conn or refuse the
new conn.
2025-06-18 17:19:09 +08:00
yyforyongyu
599650fa2d lncfg+lnd: add new dev config unsafeconnect
This flag is added so we can use it in the itest to mimic racing inbound
and outbound connections.
2025-06-18 17:19:09 +08:00
yyforyongyu
cc7ed5a9d2 lncfg: fix typo 2025-06-18 17:19:09 +08:00
Elle Mouton
f89e3ceced graph/db+sqldb: implement ForEachSourceNodeChannel
In this commit, the ForEachSourceNodeChannel implementation of the
SQLStore is added. Since this is the first method of the SQLStore that
fetches channel and policy info, it also adds all the helpers that are
required to do so. These will be re-used in upcoming commits as more
"For"-type methods are added.

With this implementation, we convert the `TestForEachSourceNodeChannel`
such that it is run against SQL backends.
2025-06-18 08:43:56 +02:00
Elle Mouton
3ed53cdcba graph/db: cache source node info
Save future round trips by caching source node info since this info will
never change.
2025-06-18 08:26:38 +02:00
Oliver Gugger
a27bd69b9c Merge pull request #9956 from ellemouton/chanGraphContext
multi: add `context.Context` param to some `graphdb.V1Store` methods
2025-06-17 20:34:56 +02:00