Commit Graph

955 Commits

Author SHA1 Message Date
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
16126d7703 graph/db: expose reset in ForEachSourceNodeChannel 2025-07-15 11:23:27 +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
85fda8b926 routing+server: let ForAllOutgoingChannels take a context
And so, remove a previously added context.TODO
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
Elle Mouton
67c0f54e13 graph/db+server: let ForEachSourceNodeChannel take a context 2025-07-08 15:10:30 +02:00
Elle Mouton
792970e50c server: create call-back helper forEachSrcNodeChan
We do this so that in an upcoming commit, we can expand the param list
of the call-back without adding another indent to the call-back code.
2025-07-08 15:10:30 +02:00
Elle Mouton
6295211d1a server: use errors.Is for error comparison 2025-07-08 15:10:29 +02:00
yyforyongyu
d44b480977 lnd: fix notifying peer online event too early
We need to notify the peer is online only when it has been started
successfully.
2025-07-04 04:19:59 +08:00
yyforyongyu
127b0e9f41 multi: add new config QuiescenceTimeout
This commit makes removes the `defaultQuiescenceTimeout` and makes it
configurable as different nodes have different network environment. In
addition the default timeout has been increased from 30s to 60s.
2025-07-04 04:19:59 +08:00
Oliver Gugger
538723e33b Merge pull request #10016 from ellemouton/fixAccessManLogging
accessman: Fix pub key formatting in logs
2025-07-01 19:49:26 +02:00
Elle Mouton
37d6390642 discovery: use a no-op hash accumluator for local networks
If LND is running on a local network, then use deterministic sampling so
that we can have deterministic peer bootstrapping.
2025-07-01 11:27:18 +02:00
Elle Mouton
bca6c0d115 server: use IsLocalNetwork check for DNS bootstrapper decision
It should be ok to use IsLocalNetwork here since the
chainreg.ChainDNSSeeds map does not have an entry for either simnet or
regtest.
2025-07-01 11:24:39 +02:00
Elle Mouton
3cb61bee95 server: make use of structured logging for peer connections 2025-07-01 08:03:19 +02:00
Elle Mouton
a1006d8372 accessman: fix structured logging formatting 2025-07-01 07:43:26 +02:00
Elle Mouton
0862ba3f41 server: ensure newer node announcement timestamp
On startup, we currently blindly overwrite our node announcement info
for our source node. This includes overwriting the existing LastUpdate
timestamp. This can cause an issue with our new SQL backends in the case
that the new timestamp is not greater than the previously written
timestamp. So here, we first fetch the source node and make sure to use
a timestamp that is greater than the previosly set one.
2025-06-30 09:46:55 +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
ziggie
409561ac62 lnd: rename removePeer to removePeerUnsafe
rename `removePeer` to highlight that the mutex has to be acquired
before calling it.
2025-06-25 13:50:17 +02:00
ziggie
3329308bce multi: fix deadlock in p2p race condition
In case we cannot guarantee that the peers has started up
completely we launch the disconnect method asynchronously.
2025-06-25 13:50:17 +02:00
Elle Mouton
38862d3b91 server: remove shouldPeerBootstrap
We already set `nobootstrap` in the default node flags for itest nodes,
so we can remove this check now. This will allow us to later test
bootstrapping in an itest. NOTE that with this change, any
signet/simnet/regtest network users will now need to explicitly add the
`--nobootstrap` flag if they want to prevent automatic bootstrapping.
This warning is added to the release notes later on.
2025-06-24 12:48:00 +02:00
Olaoluwa Osuntokun
faa68a220e Merge pull request #9880 from yyforyongyu/accessman
Improve access control in peer connections
2025-06-20 15:26:24 -07:00
Elle Mouton
91513623b5 routing: remove a context.TODO() 2025-06-19 14:49:32 +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
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
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
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
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
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
Elle Mouton
e724e1c3e4 multi: thread context through to AddrsForNode 2025-06-17 19:20:59 +02:00
Elle Mouton
66c5a97202 graph/db: thread context through to FetchLightingNode 2025-06-17 19:20:27 +02:00
Mohamed Awnallah
d26a84e18b server.go: prevent partial mutation of currNodeAnn
In this commit, we prevent partial mutation of current
node announcement during announcement signing. If node
announcement signing failed the current node announcement
becomes inconsistent.
2025-06-14 14:23:34 +00:00
Elle Mouton
c68a19c0ba discovery: revert passing ctx through to Start methods 2025-05-22 14:14:39 +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
42e87396ec graph/db: introduce ForEachSourceNodeChannel
In preparation for creating a clean interface for the graph store, we
want to hide anything that is DB specific from the exposed methods on
the interface. Currently the `ForEachNodeChannel` and the
`FetchOtherNode` methods of the `KVStore` expose a `kvdb.RTx` parameter
which is bbolt specific. There is only one call-site of
`ForEachNodeChannel` actually makes use of the passed `kvdb.RTx`
parameter, and that is in the `establishPersistentConnections` method of
the `server` which then passes the tx parameter to `FetchOtherNode`.

So to clean-up the interface such that the `kvdb.RTx` is no longer
exposed: we instead create one new method called
`ForEachSourceNodeChannel` which can be used to replace the above
mentioned call-site. So as of this commit, all the remaining call-site
of `ForEachNodeChannel` pass in a nil param for `kvdb.RTx` - meaning we
can remove the parameter in a future commit.
2025-05-22 14:14:39 +02:00
Elle Mouton
291381ef86 discovery: pass context through to bootstrapper SampleNodeAddrs
Since the ChannelGraphBootstrapper implementation makes a call to the
graph DB.
2025-05-22 14:14:37 +02:00
Elle Mouton
7fd453f319 discovery: thread context through to gossiper
Pass the parent LND context to the gossiper, let it derive a child
context that gets cancelled on Stop. Pass the context through to any
methods that will eventually thread it through to any graph DB calls.

One `context.TODO()` is added here - this will be removed in the next
commit.

NOTE: for any internal methods that the context gets passed to, if those
methods already listen on the gossiper's `quit` channel, then then don't
need to also listen on the passed context's Done() channel because the
quit channel is closed at the same time that the context is cancelled.
2025-05-22 14:14:36 +02:00
Elle Mouton
53ba229436 lnd: pass context to newServer and server.Start
In preparation for starting to thread a single parent context through
LND, we update the main `server.Start` method to take a context so that
it can later pass it to any subsytem's Start method it calls. We also
pass the context to `newServer` since it makes some calls that will
eventually reach the DB (for example the graph db).
2025-05-22 14:14:36 +02:00
Olaoluwa Osuntokun
c493f0c0a9 peer+lnd: add new CLI option to control if we D/C on slow pongs
In this commit, we add a new CLI option to control if we D/C on slow
pongs or not. Due to the existence of head-of-the-line blocking at
various levels of abstraction (app buffer, slow processing, TCP kernel
buffers, etc), if there's a flurry of gossip messages (eg: 1K channel
updates), then even with a reasonable processing latency, a peer may
still not read our ping in time.

To give users another option, we add a flag that allows users to disable
this behavior. The default remains.
2025-05-15 16:36:38 +02:00
Olaoluwa Osuntokun
c5d3d76c33 peer+server: downgrade to legacy coop close for taproot channels
In this commit, we implement logic to downgrade to the legacy coop close
for taproot channels. Before this commit, we wouldn't allow nodes to
start up with both the taproot flag and the rbf flag activated.

In the future, once we implement the spec updates, we'll add support for
this combo, and can revert parts of this commit.
2025-04-01 16:41:26 -07:00
yyforyongyu
b1e55f5fe5 lnd: don't abort the startup on subsystem errors
We want to make sure the node can start if non-fatal error is returned.
2025-03-26 14:15:52 +08:00
yyforyongyu
799ce9752a lnd: skip ErrEdgeNotFound when iterating channels
We now skip another error when iterating the channels for our persistent
peers to unblock connecting to other peers.
2025-03-26 00:25:30 +08:00
yyforyongyu
dd8f2888a0 lnd: log errors during the startup flow
To aid us debugging startup issues.
2025-03-26 00:25:30 +08:00
Oliver Gugger
d1093cd3c3 Merge pull request #9642 from yyforyongyu/skip-blockbeat
lnd: skip setting `blockbeat` for `nochainbackend` mode
2025-03-25 08:20:34 -06:00
Oliver Gugger
af2f11edff Merge pull request #9544 from lightningnetwork/elle-graphCacheBase
graph: move graph cache out of CRUD layer
2025-03-25 07:43:06 -06:00