Commit Graph

934 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
27778cbe06 multi: wire up gossip filter concurrency config
In this commit, we complete the integration of the configurable gossip
filter concurrency by wiring the new FilterConcurrency configuration
through all layers of the application.

The changes connect the gossip.filter-concurrency configuration option
from the command-line interface through the server initialization code
to the gossiper and sync manager. This ensures that operators can
actually use the new configuration option to tune their node's
concurrent gossip filter processing capacity based on their specific
requirements and available resources.
2025-08-06 11:34:42 +02:00
Oliver Gugger
8a185a12d1 server: fix rebase issue 2025-07-03 17:54:17 +02:00
Elle Mouton
6bbc438077 server: make use of structured logging for peer connections 2025-07-01 20:09:43 +02:00
Elle Mouton
f6c41565d1 accessman: fix structured logging formatting 2025-07-01 20:09:07 +02:00
Elle Mouton
2a578737f6 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-07-01 20:08:15 +02:00
Elle Mouton
9b877b94c3 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-07-01 20:08:12 +02:00
ziggie
78313e3436 lnd: rename removePeer to removePeerUnsafe
rename `removePeer` to highlight that the mutex has to be acquired
before calling it.
2025-06-26 08:49:10 +02:00
ziggie
67e7e29413 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-26 08:48:39 +02:00
yyforyongyu
da13c7ab66 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-20 15:50:45 -07:00
yyforyongyu
a8d1985fd6 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-20 15:50:45 -07:00
yyforyongyu
107b74d81d accessman+lnd: rename checkIncomingConnBanScore for clarity 2025-06-20 15:50:45 -07:00
yyforyongyu
d170ef3efe lnd: add string representation for peerAccessStatus 2025-06-20 15:50:25 -07:00
yyforyongyu
bd99924383 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-20 15:50:25 -07:00
yyforyongyu
bc6008f854 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-20 15:50:25 -07:00
yyforyongyu
a0439155d4 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-20 15:50:25 -07:00
yyforyongyu
5dfc5f4b42 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-20 15:50:25 -07:00
Elle Mouton
6202597eec discovery: revert passing ctx through to Start methods 2025-06-04 10:54:35 +02:00
Elle Mouton
2f99706fa1 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-06-04 10:54:35 +02:00
Elle Mouton
c15740ba09 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-06-04 10:54:35 +02:00
Elle Mouton
6b95b7933c discovery: pass context through to bootstrapper SampleNodeAddrs
Since the ChannelGraphBootstrapper implementation makes a call to the
graph DB.
2025-06-04 10:54:33 +02:00
Elle Mouton
e2c184f235 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-06-04 10:54:32 +02:00
Elle Mouton
4fca1f35ae 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-06-04 10:54:32 +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
yyforyongyu
ab9004492e lnd: skip setting blockbeat for nochainbackend mode
If we are in `nochainbackend` mode, we need to skip fetching the best
block during startup, otherwise it will be blocked.
2025-03-25 20:57:51 +08:00
Olaoluwa Osuntokun
c7ed5d65c6 multi: add new config options to tune gossip msg allocated bandwidth
We go with the defaults of if no values are set.
2025-03-24 19:21:45 -07:00
Oliver Gugger
0aea482b51 multi: add testnet4 support 2025-03-24 11:53:23 -05:00
Elle Mouton
2221aaa889 graph/db: move Topology client management to ChannelGraph
We plan to later on add an option for a remote graph source which will
be managed from the ChannelGraph. In such a set-up, a node would rely on
the remote graph source for graph updates instead of from gossip sync.
In this scenario, however, our topology subscription logic should still
notify clients of all updates and so it makes more sense to have the
logic as part of the ChannelGraph so that we can send updates we receive
from the remote graph.
2025-03-24 15:05:48 +02:00
Elle Mouton
b497c4694e multi: add Start and Stop methods for ChannelGraph
We do this in preparation for moving channel cache population logic out
of the constructor and into the Start method. We also will later on
(when topology subscription is moved to the ChannelGraph), have a
goroutine that will need to be kicked off and stopped.
2025-03-24 15:05:47 +02:00
Olaoluwa Osuntokun
3a18bf088c multi: enable RBF co-op bumps after reconnection
In this commit, we alter the existing co-op close flow to enable RBF
bumps after re connection. With the new RBF close flow, it's possible
that after a success round _and_ a re connection, either side wants to do
another fee bump. Typically we route these requests through the switch,
but in this case, the link no longer exists in the switch, so any
requests to fee bump again would find that the link doesn't exist.

In this commit, we implement a work around wherein if we have an RBF
chan closer active, and the link isn't in the switch, then we just route
the request directly to the chan closer via the peer. Once we have the
chan closer, we can use the exact same flow as prior.
2025-03-18 11:44:21 -05:00
Olaoluwa Osuntokun
429bbf33ef server: thread through new NoRbfCoopClose option
For now, we disallow the option to be used with the taproot chans
option, as the new flow hasn't yet been updated for nonce usage.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
bf3007a2ce multi: thread thru RPC caller context from CloseChannel 2025-03-18 11:44:20 -05:00
Eugene Siegel
68ec766b61 funding+server.go: modify notifications to pass through server
This modifies the various channelnotifier notification functions
to instead hit the server and then call the notification routine.
This allows us to accurately modify the server's maps.
2025-03-11 20:42:35 -04:00
Eugene Siegel
6eb746fbba server.go+accessman.go: introduce caches for access permissions
Here we introduce the access manager which has caches that will
determine the access control status of our peers. Peers that have
had their funding transaction confirm with us are protected. Peers
that only have pending-open channels with us are temporary access
and can have their access revoked. The rest of the peers are granted
restricted access.
2025-03-11 20:42:34 -04:00
Nishant Bansal
4569c07e08 multi: Add itest for funding timeout
This commit adds an integration test that
verifies the funding timeout behavior in the
funding manager, in dev/integration test.
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-03-07 21:32:38 +05:30
Elle Mouton
e004447da6 multi: remove the need for the graphsession package
In this commit, we add a `GraphSession` method to the `ChannelGraph`.
This method provides a caller with access to a `NodeTraverser`. This is
used by pathfinding to create a graph "session" overwhich to perform a
set of queries for a pathfinding attempt. With this refactor, we hide
details such as DB transaction creation and transaction commits from the
caller. So with this, pathfinding does not need to remember to "close
the graph session". With this commit, the `graphsession` package may be
completely removed.
2025-02-18 10:15:41 -03:00
Elle Mouton
8ec08fbfa4 multi: remove the need for NewRoutingGraph
The `graphsession.NewRoutingGraph` method was used to create a
RoutingGraph instance with no consistent read transaction across calls.
But now that the ChannelGraph directly implements this, we can remove
The NewRoutingGraph method.
2025-02-18 07:59:57 -03:00
Elle Mouton
22e391f055 discovery: add AssumeChannelValid config option
in preparation for later on when we need to know when to skip funding
transaction validation.
2025-02-12 13:15:54 +02:00
Abdullahi Yunus
84f039db45 lnd+chanbackup: add lnd config flag
In this commit, we add the --no-backup-archive with a default
as false. When set to true then previous channel backup file will
not be archived but replaced. We also modify TestUpdateAndSwap
test to make sure the new behaviour works as expected.
2025-01-24 10:56:15 +01:00
yyforyongyu
27a05694cb multi: make ProofMatureDelta configurable
We add a new config option to set the `ProofMatureDelta` so the users
can tune their graphs based on their own preference over the num of
confs found in the announcement signatures.
2025-01-17 21:44:23 +08:00
yyforyongyu
8fc9154506 lnd: start blockbeatDispatcher and register consumers 2024-12-20 17:54:03 +08:00
yyforyongyu
16a8b623b3 lnd: add new method startLowLevelServices
In this commit we start to break up the starting process into smaller
pieces, which is needed in the following commit to initialize blockbeat
consumers.
2024-12-20 17:54:02 +08:00
yyforyongyu
545cea0546 multi: start consumers with a starting blockbeat
This is needed so the consumers have an initial state about the current
block.
2024-12-20 17:54:02 +08:00
Olaoluwa Osuntokun
fb429d658b Merge pull request #9330 from ProofOfKeags/update/fn2
multi: update to fn v2
2024-12-09 12:56:23 +01:00
Oliver Gugger
86b3be71fe multi: thread through and use AuxTrafficShaper 2024-12-05 12:39:34 +01:00