Commit Graph

18160 Commits

Author SHA1 Message Date
b86980ec40 channeldb: remove graph db from channeldb
Now that the channel.DB no longer uses the ChannelGraph pointer, we can
completely remove it as a member of channeldb.DB.
2024-11-28 13:36:15 +02:00
2c083bc017 multi: let chan and graph db implement AddrSource
Then use both to construct a multiAddrSource AddrSource and use that
around the code-base.
2024-11-28 13:36:15 +02:00
51c2f709e1 channeldb: let AddrsForNode indicate if the node was found or not
Before this commit, the `(channeldb.DB).AddrsForNode` method treats the
results from the channel db and the graph db slightly differently. It
errors out if the channel db is unaware of the node in question but does
not error out if the graph is unaware of the node. So this commit
changes the logic slightly so that a "node-unknown" error from either
backing source is not seen as an error.
2024-11-28 13:36:15 +02:00
9537026df9 channeldb: implement a multi-source AddrSource
In this commit, we implement a version of the AddrSource interface which
merges the results of a set of AddrSource implementations. This will
later be used to merge the results of the channel db and graph db.
2024-11-28 13:36:15 +02:00
083d3c9d7c channeldb: define a single AddrSource interface
Our aim is to completely remove the `channeldb.DB`'s direct dependence
on the `graphdb.ChannelGraph` pointer. The only place where it still
depends on this pointer is in the `(DB).AddrsForNode(..)` method where
it queries both the channel DB and the graph db for the known addresses
for the node in question and then combines the results. So, to separate
these out, we will define an AddrsForNodes interface in this commit
which we will later let both the ChannelGraph and channeldb.DB both
implement and we will merge these results outside of the channeldb
package.

All this commit does is to unify the `AddrSource` interface since this
has been defined separately in a couple of places.
2024-11-28 13:36:15 +02:00
1859993734 channeldb+graphdb: init graph DB outside of channel db
We also now use the graph DB's own optional functions. An instance of
the graph is currently still passed to the channeldb's
`CreateWithBackend` function. This will be removed in a later commit
once the two have been completely disjoint.
2024-11-28 13:36:15 +02:00
74a4b1922b refactor: move graph related DB code to graph/db from channeldb
This is a pure refactor commit. It moves over all the graph related CRUD
code from `channeldb` to `graph/db`.
2024-11-28 13:36:13 +02:00
9f54ec90aa multi+refactor: move models package to graph/db
All the structs defined in the `channeldb/models` package are graph
related. So once we move all the graph CRUD code to the graph package,
it makes sense to have the schema structs there too. So this just moves
the `models` package over to `graph/db/models`.
2024-11-28 13:34:33 +02:00
b707fd55b2 contractcourt: use graphdb outpoint helpers
Start using the single set of exported write/read functions for
wire.Outpoint.
2024-11-28 13:34:08 +02:00
382539a6eb channeldb/graphdb: move outpoint ser/deser funcs to graphdb
We have the same helpers for writing and reading a wire.Outpoint type
defined separately in a couple places. We will want to use these from
the graph db package soon though so instead of defining them again
there, this commit unifies things and creates a single exported set of
helpers. The next commit will make use of these.
2024-11-28 13:34:08 +02:00
3365461500 channeldb+graph/db: move net.Addr encode/decode to graph db package
In preparation for moving the graph related schema structs to the graph
package in an upcoming commit, we move these methods to the graph
package. The structs we will move make use of these methods but we still
import them from channeldb so as to keep the ReadElement and
WriteElement helpers working as they do today.
2024-11-28 13:34:08 +02:00
1e81d83f78 channeldb: export net.Addr encode/decode methods
We'll move these to the new graphdb package later and import them from
there.
2024-11-28 13:34:08 +02:00
4681b52c5a make: remove exotic build targets from release list
With this commit we remove build targets from our list of release build
OS/architecture pairs to reduce the overhead of building for them with
every pull request and every release.

According to https://tooomm.github.io/github-release-stats/?username=lightningnetwork&repository=lnd
those targets are rarely used, compared to the most popular ones:

| Release File                          | Absolute DL | Relative DL |
|---------------------------------------|-------------|-------------|
| lnd-darwin-amd64-v0.18.3-beta.tar.gz  | 1,930       | 72          |
| lnd-darwin-arm64-v0.18.3-beta.tar.gz  | 2,020       | 162         |
| lnd-freebsd-386-v0.18.3-beta.tar.gz   | 1,864       | 6           |
| lnd-freebsd-amd64-v0.18.3-beta.tar.gz | 1,874       | 16          |
| lnd-freebsd-arm-v0.18.3-beta.tar.gz   | 1,865       | 7           |
| lnd-linux-386-v0.18.3-beta.tar.gz     | 1,873       | 15          |
| lnd-linux-amd64-v0.18.3-beta.tar.gz   | 3,355       | 1,497       |
| lnd-linux-arm64-v0.18.3-beta.tar.gz   | 3,053       | 1,195       |
| lnd-linux-armv6-v0.18.3-beta.tar.gz   | 1,868       | 10          |
| lnd-linux-armv7-v0.18.3-beta.tar.gz   | 1,893       | 35          |
| lnd-linux-mips-v0.18.3-beta.tar.gz    | 1,859       | 1           |
| lnd-linux-mips64-v0.18.3-beta.tar.gz  | 1,860       | 2           |
| lnd-linux-mipsle-v0.18.3-beta.tar.gz  | 1,859       | 1           |
| lnd-linux-ppc64-v0.18.3-beta.tar.gz   | 1,858       | 0           |
| lnd-linux-ppc64le-v0.18.3-beta.tar.gz | 1,859       | 1           |
| lnd-linux-s390x-v0.18.3-beta.tar.gz   | 1,859       | 1           |
| lnd-netbsd-amd64-v0.18.3-beta.tar.gz  | 1,859       | 1           |
| lnd-openbsd-amd64-v0.18.3-beta.tar.gz | 1,861       | 3           |
| lnd-source-v0.18.3-beta.tar.gz        | 1,863       | 5           |
| lnd-windows-386-v0.18.3-beta.zip      | 1,895       | 37          |
| lnd-windows-amd64-v0.18.3-beta.zip    | 1,997       | 139         |
| lnd-windows-arm-v0.18.3-beta.zip      | 1,868       | 10          |
2024-11-28 09:42:05 +01:00
1ebdefb943 Merge pull request #9311 from Roasbeef/protofsm-race-fix
protofsm: fix race in state machine executor tests
2024-11-28 09:28:04 +01:00
23b025cff6 docs: add release notes (feerate estimator) 2024-11-27 10:30:52 -03:00
b89387a6da chainreg: use feerate estimator in regtest, simnet
If feeurl is not provided and LND is running in bitcoind or btcd mode, use
fee estimator provided by bitcoind or btcd instead of using static fee estimator
(which always returns 50 sats/vbyte).

This enables simulating high feerate environment in regtest and simnet not only
via feeurl, but also by filling mempool with high feerate transactions, which is
closer to what happens in mainnet.

Also skip creating bitcoind or btcd fee estimator, if feeurl is provided. Before
LND logged both "Initializing bitcoind backed fee estimator" and "Using external
fee estimator" if running in bitcoind mode with feeurl provided, but actually
feeurl was used, so this is not a change of behavior.
2024-11-27 10:24:26 -03:00
ae32c29deb Merge pull request #9295 from ellemouton/logPerformanceFix
go.mod: bump btclog dep
2024-11-27 11:43:43 +01:00
c2923e2214 multi: remove PrefixLog
And instead use the new btclog Logger `WithPrefix` method.
2024-11-27 10:44:32 +02:00
b98fc168ec go.mod+build: update btclog dep 2024-11-27 10:44:01 +02:00
c8cfa59316 Merge pull request #8270 from ProofOfKeags/feature/stfu
DynComms [1/n]: Implement Quiescence Protocol
2024-11-27 09:27:34 +01:00
0ff0ac84f6 protofsm: fix race in state machine executor tests
In this commit, we fix an existing race in the new `protofsm` state
machine executor tests.

The race would appear as such:
```
--- FAIL: TestStateMachineMsgMapper (0.00s)
    state_machine_test.go:165:
        Error Trace:/home/runner/work/lnd/lnd/protofsm/state_machine_test.go:165
                    /home/runner/work/lnd/lnd/protofsm/state_machine_test.go:451
        Error:      Object expected to be of type *protofsm.dummyStateStart, but was *protofsm.dummyStateFin
        Test:       TestStateMachineMsgMapper
FAIL
FAILgithub.com/lightningnetwork/lnd/protofsm0.116s
FAIL
```

This race condition was triggered as before we would start the state
machine _then_ register for notifications. In `Start` we emit the
starting event, then enter the main loop. If that event gets emitted
before our subscription, then we'll miss the event, as the terminal
event will be the only one received.

We fix this by registering for the events before the daemon has started.
2024-11-26 18:58:53 -06:00
debc43daf2 docs: add quiescence to release notes 2024-11-26 14:13:44 -07:00
127e4fff28 htlcswitch: add logging to quiescer 2024-11-26 14:13:44 -07:00
ac0c24aa7b htlcswitch: don't pass pending update counts into quiescer
This change simplifies some of the quiescer responsibilities in
favor of making the link check whether or not it has a clean state
to be able to send or receive an stfu. This change was made on the
basis that the only use the quiescer makes of this information is
to assess that it is or is not zero. Further the difficulty of
checking this condition in the link is barely more burdensome than
selecting the proper information to pass to the quiescer anyway.
2024-11-26 14:13:43 -07:00
a4c49a88f1 htlcswitch: add quiescence timeout that is aborted by Resume 2024-11-26 14:13:43 -07:00
111c9b05f3 htlcswitch+peer: allow the disabling of quiescence
Here we add a flag where we can disable quiescence. This will be used
in the case where the feature is not negotiated with our peer.
2024-11-26 14:13:39 -07:00
48ee643c0d htlcswitch: implement noop quiescer
In this commit we implement a noop quiescer that we will use when
the feature hasn't been negotiated. This will make it far easier to
manage quiescence operations without having a number of if statements
in the link logic.
2024-11-26 13:52:54 -07:00
5906ca2537 htlcswitch: add test for deferred processing remote adds when quiescent 2024-11-26 13:52:54 -07:00
4fbab45a5f htlcswitch: defer processRemoteAdds when quiescent
In this commit we defer processRemoteAdds using a new mechanism on
the quiescer where we capture a closure that needs to be run. We
do this because we need to avoid the scenario where we send back
immediate resolutions to the newly added HTLCs when quiescent as
it is a protocol violation. It is not enough for us to simply defer
sending the messages since the purpose of quiescence itself is to
have well-defined and agreed upon channel state. If, for whatever
reason, the node (or connection) is restarted between when these
hooks are captured and when they are ultimately run, they will
be resolved by the resolveFwdPkgs logic when the link comes back
up.

In a future commit we will explicitly call the quiescer's resume
method when it is OK for htlc traffic to commence.
2024-11-26 13:52:53 -07:00
77fd8c6a21 itest+lntest: add itest for Quiesce RPC method 2024-11-26 13:52:51 -07:00
7255b7357c htlcswitch: implement InitStfu link operation 2024-11-26 13:51:57 -07:00
bca1516429 lnd: finish Quiesce implementation using new link op 2024-11-26 13:51:57 -07:00
70e3804121 htlcswitch: add link operation for initiating quiescence 2024-11-26 13:51:57 -07:00
a085b59814 lnd: implement new Quiesce RPC with link operation stub 2024-11-26 13:51:57 -07:00
99f5ca4018 lnrpc add new RPC 'Quiesce' to protobuf definitions 2024-11-26 13:51:57 -07:00
7a5b55a473 lnwire: signal that we support quiescence 2024-11-26 13:51:56 -07:00
6d30ab6c4f htlcswitch: drop connection if link updates after stfu 2024-11-26 13:51:56 -07:00
44c87ef1d7 htlcswitch: bounce packets when quiescent 2024-11-26 13:51:56 -07:00
c9debea408 lnwire: add IsChannelUpdate function to distinguish channel updates 2024-11-26 13:51:56 -07:00
2ece1fdc54 htlcswitch: implement stfu response
htlcswitch: use quiescer SendOwedStfu method in link stfu implementation
2024-11-26 13:51:56 -07:00
f5b7866287 htlcswitch: define state machine for quiescence
htlcswitch: add sendOwedStfu method to quiescer
2024-11-26 13:51:46 -07:00
fbeab726e1 Merge pull request #8390 from carlaKC/7883-experimental-endorsement
Add Experimental Endorsement Signalling
2024-11-26 09:43:22 +02:00
2a1384174b tlv: update to fn v2 2024-11-25 13:25:52 -07:00
66940024ac Merge pull request #9290 from w3irdrobot/broadcast-misspelling
docs: fix broadcast misspelling
2024-11-25 12:25:51 +01:00
7e8dc2d389 Merge pull request #9301 from chuangjinglu/master
multi: fix some function names in interface comment
2024-11-25 11:59:01 +01:00
bcfd8d5b47 multi: fix some function names in interface comment
Signed-off-by: chuangjinglu <chuangjinglu@outlook.com>
2024-11-25 10:49:00 +08:00
d3bff47167 docs: fix broadcast misspelling 2024-11-22 16:20:02 -05:00
a8c159b1c7 docs: add experimental endorsement 2024-11-22 09:31:47 -05:00
7a876e8898 itest: add coverage for experimental endorsement 2024-11-22 09:31:46 -05:00
f02bb58486 multi: add experimental endorsement feature bit and disable option 2024-11-22 09:16:58 -05:00