Commit Graph

18489 Commits

Author SHA1 Message Date
cc4fcbf838 graph/db: move cache writes for Prune methods
This commit moves the cache writes for PruneGraphNodes and PruneGraph
from the KVStore to the ChannelGraph.
2025-03-24 15:05:47 +02:00
941e7bf6b3 graph/db: move cache update out of pruneGraphNodes
In preparation for moving the cache write completely out of KVStore, we
move the cache write up one layer.
2025-03-24 15:05:46 +02:00
71e5ab6200 graph/db: move some cache writes to ChannelGraph.
Here we move the cache writes for DisconnectBlockAtHeight and
DeleteChannelEdges to the ChannelGraph.
2025-03-24 15:05:46 +02:00
081c9dc082 graph/db: refactor delChannelEdgeUnsafe to return edge info
And update cache outside the method rather. This will make it easier to
completely move the cache write out to the ChannelGraph layer.
2025-03-24 15:05:46 +02:00
f75e6a1c10 graph/db: move various cache write calls to ChannelGraph
Here, we move the graph cache writes for AddLightningNode,
DeleteLightningNode, AddChannelEdge and MarkEdgeLive to the
ChannelGraph. Since these are writes, the cache is only updated if the
DB write is successful.
2025-03-24 15:05:46 +02:00
9fe9e32c6e graph/db: move cache read checks to ChannelGraph.
This commit moves the graph cache checks for FetchNodeFeatures,
ForEachNodeDirectedChannel, GraphSession and ForEachNodeCached from the
KVStore to the ChannelGraph. Since the ChannelGraph is currently just a
pass-through for any of the KVStore methods, all that needs to be done
for calls to go via the ChannelGraph instead directly to the KVStore is
for the ChannelGraph to go and implement those methods.
2025-03-24 15:05:46 +02:00
88398e3dd9 graph/db: let ChannelGraph init the graphCache
In this commit, we let the ChannelGraph be responsible for populating
the graphCache and then passing it to the KVStore. This is a first step
in moving the graphCache completely out of the KVStore layer.
2025-03-24 15:05:46 +02:00
00432e46f3 multi: add ChannelGraph Config struct
And use this struct to pass NewChannelGraph anything it needs to be able
to init the KVStore that it houses. This will allow us to add
ChannelGraph specific options.
2025-03-24 15:05:46 +02:00
81e0608c10 graph/db: rename Options to KVStoreOptions
Namespace these options so that we can introduce separate options for
the new ChannelGraph.
2025-03-24 15:05:46 +02:00
ae3961b47f graph/db: fix linter issues of old code
Since we have renamed a file housing some very old code, the linter has
now run on all this code for the first time. So we gotta do some
clean-up work here to make it happy.
2025-03-24 15:05:46 +02:00
1ee4bb8c51 graph/db: rename ChannelGraph and introduce the new ChannelGraph layer
In this commit, we rename the existing ChannelGraph struct to KVStore to
better reflect its responsibilities as the CRUD layer. We then introduce
a new ChannelGraph struct which will eventually be the layer above the
CRUD layer in which we will handle cacheing and topology subscriptions.
For now, however, it houses only the KVStore. This means that all calls
to the KVStore will now go through this layer of indirection first. This
will allow us to slowly move the graph Cache management out of the
KVStore and into the new ChannelGraph layer.

We introduce the new ChannelGraph and rename the old one in the same
commit so that all existing call-sites don't need to change at all :)
2025-03-24 15:05:46 +02:00
ed8e10e4b9 graph/db: rename graph.go file
Rename it to kv_store.go so that we can re-use the graph.go file name
later on. We will use it to house the _new_ ChannelGraph when the
existing ChannelGraph is renamed to more clearly reflect its
responsibilities as the CRUD layer.
2025-03-24 15:05:46 +02:00
5235f3b24f Merge pull request #9623 from Roasbeef/size-msg-test-msg
Size msg test msg
2025-03-21 12:18:36 -07:00
05a6b6838f lnwire: add new TestSerializedSize method
This uses all the interfaces and implementations added in the prior test.
2025-03-20 18:28:53 -07:00
b2f24789dc lnwire: revamp TestLightningWireProtocol using new rapid test gen
With what we added in the prior commit, we can significantly shrink the
size of this test. We also make it easier to extend in the future, as
this will fail if a new message is added, that doesn't have the needed
methods, as long as MsgEnd is updated.
2025-03-20 18:28:23 -07:00
eb877db2ff lnwire: add new TestMessage interface for property tests
In this commit, we add a new `TestMessage` interface for use in property
tests. With this, we'll be able to generate a random instance of a given
message, using the rapid byte stream. This can also eventually be useful
for fuzzing.
2025-03-20 18:28:07 -07:00
56a100123b lnwire: add new SerializedSize method to all wire messages
This'll be useful for the bandwidth based rate limiting we'll implement
in the next commit.
2025-03-20 18:27:52 -07:00
5d921723b1 Merge pull request #9609 from yyforyongyu/fix-listunspent
Fix inaccurate `listunspent` result
2025-03-21 09:22:11 +08:00
bdcd980868 docs: update release notes 2025-03-21 08:06:19 +08:00
ea66dacc07 itest: skip force close restart in windows 2025-03-21 08:06:19 +08:00
feeb9acaa7 itest: document flakeRaceInBitcoinClientNotifications 2025-03-21 08:06:19 +08:00
f0300762c0 lnwallet: move btcwallet log under BTWL
So we can focus on debugging `BTWL` without concerning `lnwallet`, which
has a lot of channel-specific loggings.
2025-03-21 08:06:18 +08:00
07f60bd910 lnd: enable logging for sqldb 2025-03-21 08:06:18 +08:00
9a25d7172e sweep: improve loggings 2025-03-21 08:06:18 +08:00
533aeb8a25 itest: remove flakeFundExtraUTXO 2025-03-21 08:06:18 +08:00
07c60c85f9 lnwallet: remove direct walletdb reference
To make sure the db layer is not exposed and is only managed by the
`btcwallet` package.
2025-03-21 08:06:18 +08:00
6e1c098923 gomod: update btcwallet 2025-03-21 08:06:18 +08:00
16348e61db sqldb: add trace logs in ExecuteSQLTransactionWithRetry 2025-03-21 08:06:17 +08:00
e8875e06fe Merge pull request #9602 from lightningnetwork/yy-pending-remote-commit
multi: make sure HTLCs are locked in the itest
2025-03-20 18:11:02 -05:00
3b7f9e1975 docs: update release notes 2025-03-21 03:25:24 +08:00
652d39dcc7 itest: fix flakeSkipPendingSweepsCheckDarwin
Now that we have the new RPC to assert the HTLC state, this flake should
be fixed.
2025-03-21 03:25:24 +08:00
5a72d5258f htlcswitch+itest: catch link quit signal when processing hodlQueue
This commit makes sure when processing resolutions, e.g, settling
invoices, when the link is already broken, the process would exit with
an error. This fixes the issue we found in the itest, where an
unexpected empty remote pending commitment was created although the
remote peer is already offline.
2025-03-21 03:25:24 +08:00
0892b595dd lnrpc+rpcserver: add new field LockedIn for HTLCs
In this commit, we add a new field `LockedIn` on HTLCs so it can be used
to decide whether an HTLC found on the local commitment has been
committed on the remote commitment.
2025-03-21 03:25:23 +08:00
be4c4cc8ff multi: improve logging 2025-03-21 03:24:26 +08:00
66c94cf51f contractcourt: add String to CommitSet for logging 2025-03-21 03:24:26 +08:00
c5f17180bc netann: remove unused param in newMockGraph 2025-03-21 03:24:26 +08:00
09b6745086 Merge pull request #9600 from lightningnetwork/yy-more-flakes
lntest+itest: document and fix more flakes
2025-03-21 03:23:02 +08:00
b031002aed Merge pull request #9604 from jjjike2021/fix-dep
fn: remove x/exp/slices dependency
2025-03-20 11:10:18 -06:00
ea050d06f0 Merge pull request #9610 from lightningnetwork/rbf-staging
multi: integrate rbf changes from staging branch
2025-03-19 15:01:23 -05:00
de1ed93f52 Merge pull request #9601 from bitromortac/2503-neutrino-maxpeers
lnd: pass through neutrino MaxPeers config
2025-03-18 16:41:39 -06:00
42fa83700a docs/release-notes: update release notes for RBF close 2025-03-18 12:48:01 -05:00
a93ec3b01a lnd: pass through neutrino MaxPeers config
This enables users to set the config. We check that the currently set
value of MaxPeers is non-zero.
2025-03-18 17:55:20 +01:00
3681ba6d8b peer: for RBF state machine block req if RBF iterating is outstanding
This fixes an issue in the itests in the restart case. We'd see an error
like:
```
2025-03-12 23:41:10.754 [ERR] PFSM state_machine.go:661: FSM(rbf_chan_closer(2f20725d9004f7fda7ef280f77dd8d419fd6669bda1a5231dd58d6f6597066e0:0)): Unable to apply event err="invalid state transition: received *chancloser.SendOfferEvent while in ClosingNegotiation(local=LocalOfferSent(proposed_fee=0.00000193 BTC), remote=ClosePending(txid=07229915459cb439bdb8ad4f5bf112dc6f42fca0192ea16a7d6dd05e607b92ae, party=Remote, fee_rate=1 sat/vb))"
```

We resolve this by waiting to send in the new request unil the old one
has been completed.
2025-03-18 11:44:59 -05:00
8df58a984c lnwallet/chancloser: add docs for new rbf chan closer 2025-03-18 11:44:59 -05:00
720d98cc15 msgmux: fix arg expectation for mock in unit test 2025-03-18 11:44:59 -05:00
8d9ed0ca73 docs/release-notes: add rbf coop close section 2025-03-18 11:44:59 -05:00
fccd984ac1 multi: extract new DeriveHeightHint() function, use for new rbf closer
With this commit, we make sure we set the right height hint, even if the
channel is a zero conf channel.
2025-03-18 11:44:59 -05:00
971ac5a14d itest: add new RBF coop close itest
The itest has both sides try to close multiple times, each time with
increasing fee rates. We also test the reconnection case, bad RBF
updates, and instances where the local party can't actually pay for
fees.
2025-03-18 11:44:57 -05:00
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
80b48fb49b peer: update rbf close client logic w/ error and iteration awareness
We'll properly handle a protocol error due to user input by halting, and
sending the error back to the user.

When a user goes to issue a new update, based on which state we're in,
we'll either kick off the shutdown, or attempt a new offer. This matches
the new spec update where we'll only send `Shutdown` once per
connection.
2025-03-18 11:44:21 -05:00