Commit Graph

19673 Commits

Author SHA1 Message Date
Elle Mouton
4bd2bbca27 graph/db: update test opaque addr to be valid
The first byte of an opaque addr must be one that we dont understand
yet. We do this update in preparation for doing an on-the-fly parse of
persisted opaque addrs to see if they contain addrs that we now support.
For this to work, the first byte cant be 0x01 since this maps to a known
address.
2025-09-03 01:11:35 +00:00
Elle Mouton
70b5016bc8 discovery+gossip: make sure we dont advertise node anns with bad DNS
We may have already persisted node announcements that have multiple DNS
addresses since we may have received them before updating our code to
check for this. So here we just make sure not to send these on to our
peers.
2025-09-03 01:11:35 +00:00
Elle Mouton
f0a20c9d04 netadd: split ValidatenodeAnn into sig and field checks
Check that the node ann doesnt contain more than 1 DNS addr.
This will ensure that we now start rejecting new node announcements
with multiple DNS addrs since this check is called in the gossiper
before persisting a node ann to our local graph.

It also validates the DNS fields according to BOLT #7 specs.
2025-09-03 01:11:34 +00:00
Elle Mouton
670b26ba3d lnwire: add encoding/decoding for DNS addr
Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
2025-09-02 17:51:31 +00:00
Mohamed Awnallah
a0057c2026 lnwire: add DNSAddress type 2025-09-02 17:51:31 +00:00
Mohamed Awnallah
7acd6018c9 lnwire: remove AddrLen helper
In this commit, we remove `AddrLen` as prepration step
before adding DNS address type which will have a var length.

Co-authored-by: Elle Mouton <elle.mouton@gmail.com>
2025-09-02 17:51:31 +00:00
Yong
f51684dd0f Merge pull request #10103 from yyforyongyu/rate-limit-peer
Rate limit outgoing gossip bandwidth by peer
2025-09-02 23:31:29 +08:00
yyforyongyu
86a915a772 docs: update release notes 2025-09-02 21:23:08 +08:00
yyforyongyu
6d14370e8e lncfg: validate msg-burst-bytes 2025-09-02 21:23:08 +08:00
yyforyongyu
5bc4666efc multi: add new config peer-msg-rate-bytes 2025-09-02 21:23:07 +08:00
yyforyongyu
778456769a discovery: rate limiting sending msgs per peer
We now add another layer of rate limiting before sending the messages
inside `GossipSyncer`.
2025-09-02 21:23:07 +08:00
yyforyongyu
6826703c77 discovery: introduce rate limiter to GossipSyncer 2025-09-02 21:13:46 +08:00
yyforyongyu
19bc941cbd discovery: create common helper methods for rate limiter
This allows us to reuse them in the upcoming commits where we introduce
a rate limiter to the gossip syncer.
2025-09-02 21:13:46 +08:00
Yong
1666764690 Merge pull request #10136 from yyforyongyu/use-btcwallet-interface
lnwallet: use btcwallet's new interface
2025-09-02 20:46:56 +08:00
Olaoluwa Osuntokun
d5f70c0ae3 Merge pull request #10184 from ellemouton/gemini-char-wrap
.gemini: ignore char wrapping during code review
2025-09-01 23:40:06 +01:00
Yong
84b2c20ea0 Merge pull request #10167 from starius/go124
multi: bump Go to 1.24.6
2025-09-01 20:03:54 +08:00
Elle Mouton
c2baf6f30e .gemini: ignore char wrapping during code review
Gemini code review agent is bad at counting characters.
2025-09-01 10:16:44 +02:00
Elle
cd6971ea17 Merge pull request #10161 from ellemouton/graphRetry
graph/db+sqldb: Make the SQL migration retry-safe/idempotent
2025-09-01 08:23:38 +01:00
Elle Mouton
ce1df9da34 graph/db: let the rapid migration test also tests idempotency 2025-09-01 08:08:00 +02:00
Elle Mouton
f2ed5564ef graph/db+sqldb: improve performance of chan update sql migration
This commit simplifies insertChanEdgePolicyMig. Much of the logic can be
removed given that this method is only used in the context of the graph
SQL migration.

This should improve the performance of the migration quite a lot since
it removes the extra GetChannelAndNodesBySCID call.
2025-09-01 08:07:57 +02:00
Elle Mouton
22bf88e900 graph/db+sqldb: make policy migration idempotent
Finally, we make the channel-policy part of the SQL migration idempotent
by adding a migration-only policy insert query which will not error out
if the policy already exists and does not have a timestamp that is newer
than the existing records timestamp. To keep the commit simple, a
insertChanEdgePolicyMig function is added which is basically identical
to the updateChanEdgePolicy function except for the fact that it uses
the newly added query. In the next commit, it will be simplified even
more.
2025-09-01 08:06:12 +02:00
Elle Mouton
8736fcafa8 graph/db+sqldb: make channel SQL mig retry-safe
In this commit, we make the channel part of the graph SQL migration
idempotent (retry-safe!). We do this by adding a migration-only channel
insert query that will not error out if a the query is called and a
chanenl with the given scid&version already exists. We also ensure that
errors are not thrown if existing channel features & extra types are
re-added.
2025-09-01 08:05:21 +02:00
Elle Mouton
a291d6f1a6 graph/db+sqldb: improve efficiency of node migration
There is no need to use the "collect-then-update" pattern for node
insertion during the SQL migration since if we do have any previously
persisted data for the node and happen to re-run the insertion for that
node, the data will be exactly the same. So we can make use of "On
conflict, no nothing" here too.
2025-09-01 08:02:38 +02:00
Elle Mouton
ddea6d59ce graph/db+sqldb: make node migration idempotent
In this commit, the graph SQL migration is updated so that the node
migration step is retry-safe. This is done by using migration specific
logic & queries that do not use the same node-update-constraint as the
normal node upsert logic. For normal "run-time" logic, we always expect
a node update to have a newer timestamp than any previously stored one.
But for the migration, we will only ever be dealing with a single
announcement for a given node & to make things retry-safe, we dont want
the query to error if we re-insert the exact same node.
2025-09-01 07:56:34 +02:00
Elle Mouton
2c8ac0c92c graph/db: thread through reset call-backs
In preparation for handling retries on the source DB side, we thread
through the `reset` call-backs properly so that we can reset appropriate
variables.
2025-09-01 07:56:09 +02:00
Elle Mouton
aefc9118a4 graph/db: migration test for channels with no policies
In preparation for making the channel & policy migration logic
idempotent in a step-by-step manner, we add a test here that only tests
the migration of channels _without_ policies so that we can first focus
on just making the channel migration idempotent.
2025-09-01 07:56:09 +02:00
Elle Mouton
68e4970fbb graph/db: let migration test test retry safety
Currently, the graph SQL migration is not retry safe. Meaning that if
the source DB exeutes a retry under the hood, this could result in the
migration failing. In preparation for fixing this, we adust the
migration test accordingly.
2025-09-01 07:56:09 +02:00
Elle Mouton
9019bcaddf graph/db: let test policy have some extra opaque data
This will help us test idempotency later on, but it also ensures that
TestMigrateGraphToSQL is properly testing writes to the
graph_channel_policy_extra_types table.
2025-09-01 07:56:08 +02:00
Boris Nagaev
c86826ac5b lntest: fix error check in shutdownAllNodes
Previously the test failed only if the last node failed to shutdown. The code
was updated to fail if any node failed to shutdown.
2025-08-30 14:13:44 -03:00
Boris Nagaev
630108b13d multi: golang.org/x/net/context -> context 2025-08-30 14:13:44 -03:00
Boris Nagaev
dee8ad3754 multi: context.Background() -> t.Context()
Use the new feature of Go 1.24, fix linter warnings.

This change was produced by:
 - running golangci-lint run --fix
 - sed 's/context.Background/t.Context/' -i `git grep -l context.Background | grep test.go`
 - manually fixing broken tests
 - itest, lntest: use ht.Context() where ht or hn is available
 - in HarnessNode.Stop() we keep using context.Background(), because it is
   called from a cleanup handler in which t.Context() is canceled already.
2025-08-30 14:13:44 -03:00
Boris Nagaev
6ffe257004 multi: bump Go to 1.24.6 2025-08-30 14:13:44 -03:00
Boris Nagaev
612ad7da27 multi: fix non-constant input of fmt.Errorf
Fixed multiple cases in which a non-constact string variable was used as a
format string for fmt.Errorf.
2025-08-30 14:13:44 -03:00
Boris Nagaev
f3d52ba7a8 htlcswitch: don't pass err.Error() to failf
It resulted in interpreting the error message as a format string.
Use failf("%v", err) instead.
2025-08-30 14:13:44 -03:00
Boris Nagaev
2a599bedc0 multi: don't pass err.Error() to Fatalf
It resulted in interpreting the error message as a format string.
Use Fatal(err) instead.
2025-08-30 14:13:44 -03:00
Boris Nagaev
66c7e72c0d tor: fix go vet error in Go 1.24
non-constant format string in call to (*net/textproto.Conn).Cmd
2025-08-30 14:13:44 -03:00
yyforyongyu
48f88248b8 docs: update release notes 2025-08-26 20:36:22 +08:00
yyforyongyu
b10aca5c1b lnwallet: use the wallet interface 2025-08-26 20:36:21 +08:00
yyforyongyu
2403313443 gomod: update btcwallet 2025-08-26 20:36:21 +08:00
yyforyongyu
596d969881 btcwallet: fix duplicate import
The `wallet` has already imported using `base`.
2025-08-26 20:36:21 +08:00
Boris Nagaev
8533585d0b docs/INSTALL: remove trailing spaces 2025-08-20 16:04:30 -03:00
Boris Nagaev
ba5f3c0485 tools: fix building golangci-lint on Arm64
If CGO is enabled, Go tries to use the gold linker (-fuse-ld=gold), which is
not installed. CGO was disabled, because it is not needed for golangci-lint.
2025-08-20 16:04:30 -03:00
Yong
0c2f045f5d Merge pull request #10102 from yyforyongyu/fix-UpdatesInHorizon
Catch bad gossip peer and fix `UpdatesInHorizon`
2025-08-20 22:35:31 +08:00
Yong
8f489d0f12 Merge pull request #10153 from ziggie1984/refactor-payments-code-05
Refactor Payment PR 5
2025-08-20 21:18:04 +08:00
ziggie
bf6131ba02 routing: Add comment to DeleteFailedAttempts func call 2025-08-20 09:08:19 +02:00
ziggie
039b5994f3 routing: add more comments to the ControlTower interface 2025-08-20 09:08:19 +02:00
ziggie
b16782caeb multi: move DBMPPayment to paymentsdb package 2025-08-20 09:08:19 +02:00
ziggie
9ac93e75ac paymentsdb: fix linter 2025-08-20 09:08:18 +02:00
ziggie
f87841d638 paymentsdb: declare helper functions and add comments 2025-08-20 09:07:53 +02:00
ziggie
82242f5342 multi: rename KVPaymentDB to KVStore
This matches the same naming as used in the graph package.
2025-08-20 09:07:53 +02:00