Commit graph

18127 commits

Author SHA1 Message Date
Abdullahi Yunus
3bf15485ce
docs: add release note 2025-01-24 10:58:42 +01: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
Abdullahi Yunus
a51dfe9a7d
chanbackup: archive old channel backups
In this commit, we first check if a previous backup file exists,
if it does we copy it to archive folder before replacing it with
a new backup file. We also added a test for archiving chan backups.
2025-01-24 10:56:14 +01:00
Oliver Gugger
6cabc74c20
Merge pull request #8831 from bhandras/sql-invoice-migration
invoices: migrate KV invoices to native SQL for users of KV SQL backends
2025-01-23 05:48:25 -06:00
Oliver Gugger
49affa2dc3
Merge pull request #9424 from yyforyongyu/fix-gossip-ann
multi: fix inconsistent state in gossip syncer
2025-01-23 05:25:01 -06:00
Andras Banki-Horvath
b1a462ddba
docs: update release notes for 0.19.0 2025-01-23 09:11:03 +01:00
Andras Banki-Horvath
97c025f289
invoices: raise the number of allowed clients for the Postgres fixture 2025-01-23 09:11:02 +01:00
Andras Banki-Horvath
84598b6dc1
sqldb: ensure schema definitions are fully SQLite compatible
Previously, we applied replacements to our schema definitions
to make them compatible with both SQLite and Postgres backends,
as the files were not fully compatible with either.

With this change, the only replacement required for SQLite has
been moved to the generator script. This adjustment ensures
compatibility by enabling auto-incrementing primary keys that
are treated as 64-bit integers by sqlc.
2025-01-23 09:11:02 +01:00
Andras Banki-Horvath
ea98933317
invoices: allow migration test to work on kv sqlite channeldb 2025-01-23 09:11:02 +01:00
Andras Banki-Horvath
5e3ef3ec0c
invoices+sql: use the stored AmtPaid value instead of recalculating
Previously we'd recalculate the paid amount by summing amounts of
settled HTLCs. This approach while correct would stop the SQL migration
process as some KV invoices may have incorrectly stored paid amounts.
2025-01-23 09:11:02 +01:00
Andras Banki-Horvath
0839d4ba7b
itest: remove obsolete itest 2025-01-23 09:11:02 +01:00
Andras Banki-Horvath
a29f2430c1
itest: add integration test for invoice migration 2025-01-23 09:11:01 +01:00
Andras Banki-Horvath
8d20e2a23b
lnd: run invoice migration on startup
This commit runs the invoice migration if the user has a KV SQL backend
configured.
2025-01-23 09:11:01 +01:00
Andras Banki-Horvath
94e2724a34
sqldb+invoices: Optimize invoice fetching when the reference is only a hash
The current sqlc GetInvoice query experiences incremental slowdowns during
the migration of large invoice databases, primarily due to its complex
predicate set. For this specific use case, a streamlined GetInvoiceByHash
function provides a more efficient solution, maintaining near-constant
lookup times even with extensive table sizes.
2025-01-23 09:11:01 +01:00
Andras Banki-Horvath
b92f57e0ae
invoices: add migration code that runs a full invoice DB SQL migration 2025-01-23 09:11:01 +01:00
Andras Banki-Horvath
708bed517d
invoices: add migration code for a single invoice 2025-01-23 09:11:01 +01:00
Andras Banki-Horvath
43797d6be7
invoices: add method to create payment hash index
Certain invoices may not have a deterministic payment hash. For such
invoices we still store the payment hashes in our KV database, but we do
not have a sufficient index to retrieve them. This PR adds such index to
the SQL database that will be used during migration to retrieve payment
hashes.
2025-01-23 09:11:00 +01:00
Andras Banki-Horvath
be18f55ca1
invoices: extract method to create invoice insertion params 2025-01-23 09:11:00 +01:00
Andras Banki-Horvath
d65b630568
sqldb: remove unused preimage query parameter 2025-01-23 09:11:00 +01:00
Andras Banki-Horvath
b7d743929d
sqldb: add a temporary index to store KV invoice hash to ID mapping 2025-01-23 09:11:00 +01:00
Andras Banki-Horvath
3820497d7f
sqldb: set settled_at and settle_index on invocie insertion is set
Previously we intentially did not set settled_at and settle_index when
inserting a new invoice as those fields are set when we settle an
invoice through the usual invoice update. As migration requires that we
set these nullable fields, we can safely add them.
2025-01-23 09:11:00 +01:00
Andras Banki-Horvath
115f96c29a
multi: add call to directly insert an AMP sub-invoice 2025-01-23 09:10:59 +01:00
Andras Banki-Horvath
91c3e1496f
sqldb: separate migration execution from construction
This commit separates the execution of SQL and in-code migrations
from their construction. This change is necessary because,
currently, the SQL schema is migrated during the construction
phase in the lncfg package. However, migrations are typically
executed when individual stores are constructed within the
configuration builder.
2025-01-23 09:10:59 +01:00
Andras Banki-Horvath
b789fb2db3
sqldb: add support for custom in-code migrations
This commit introduces support for custom, in-code migrations, allowing
a specific Go function to be executed at a designated database version
during sqlc migrations. If the current database version surpasses the
specified version, the migration will be skipped.
2025-01-23 09:10:59 +01:00
Andras Banki-Horvath
9acd06d296
sqldb: add table to track custom SQL migrations
This commit adds the migration_tracker table which we'll use to track if
a custom migration has already been done.
2025-01-23 09:10:59 +01:00
Andras Banki-Horvath
680394518f
mod: temporarily replace sqldb with local version 2025-01-23 09:10:58 +01:00
Oliver Gugger
1f20bd352f
Merge pull request #9429 from yyforyongyu/update-action
.github: update actions versions
2025-01-20 09:01:46 -06:00
yyforyongyu
29603954bd
.github: update actions versions 2025-01-20 21:55:20 +08:00
Oliver Gugger
baa3b0dea3
Merge pull request #9425 from yyforyongyu/flake-fix
itest: fix flake in `testSweepHTLCs`
2025-01-17 10:36:55 -06:00
Oliver Gugger
27df4af53e
Merge pull request #9359 from NishantBansal2003/fix-timeout
routerrpc: add a default value for timeout_seconds in SendPaymentV2
2025-01-17 09:43:38 -06:00
yyforyongyu
c24f839fbe
itest: fix flake in testSweepHTLCs
We need to make sure Caarol finishes settling her invoice with Bob
before shutting down, so we make sure `AssertHTLCNotActive` on Bob
happens before shutting node Carol.
2025-01-17 22:58:37 +08:00
Yong
fb91b04906
Merge pull request #9405 from yyforyongyu/fix-unused-params
discovery+lnd: make param `ProofMatureDelta` configurable
2025-01-17 22:57:26 +08:00
yyforyongyu
ae2bcfe3d8
docs: add release notes 2025-01-17 21:44:23 +08: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
56ff6d1fe0
docs: update release notes 2025-01-17 18:58:20 +08:00
yyforyongyu
772a9d5f42
discovery: fix mocked peer in unit tests
The mocked peer used here blocks on `sendToPeer`, which is not the
behavior of the `SendMessageLazy` of `lnpeer.Peer`. To reflect the
reality, we now make sure the `sendToPeer` is non-blocking in the tests.
2025-01-17 17:59:06 +08:00
yyforyongyu
9fecfed3b5
discovery: fix race access to syncer's state
This commit fixes the following race,
1. syncer(state=syncingChans) sends QueryChannelRange
2. remote peer replies ReplyChannelRange
3. ProcessQueryMsg fails to process the remote peer's msg as its state
   is neither waitingQueryChanReply nor waitingQueryRangeReply.
4. syncer marks its new state waitingQueryChanReply, but too late.

The historical sync will now fail, and the syncer will be stuck at this
state. What's worse is it cannot forward channel announcements to other
connected peers now as it will skip the broadcasting during initial
graph sync.

This is now fixed to make sure the following two steps are atomic,
1. syncer(state=syncingChans) sends QueryChannelRange
2. syncer marks its new state waitingQueryChanReply.
2025-01-17 02:39:07 +08:00
yyforyongyu
4b30b09d1c
discovery: add new method handleSyncingChans
This is a pure refactor to add a dedicated handler when the gossiper is
in state syncingChans.
2025-01-17 00:22:22 +08:00
yyforyongyu
eb2b0c783f
graph: fix staticcheck suggestion
From staticcheck: QF1002 - Convert untagged switch to tagged switch.
2025-01-17 00:21:45 +08:00
yyforyongyu
001e5599b6
multi: add debug logs for edge policy flow
This commit adds more logs around the ChannelUpdate->edge policy process
flow.
2025-01-17 00:17:23 +08:00
Yong
e0a920af44
Merge pull request #9420 from yyforyongyu/assert-channel-graph
itest+lntest: make sure to assert edge in both graph db and cache
2025-01-17 00:13:02 +08:00
yyforyongyu
faa1f67480
lntest: assert channel edge in both graph db and cache
We need to make sure the channel edge has been updated in both the graph
DB and cache.
2025-01-16 23:00:22 +08:00
yyforyongyu
e576d661ef
itest: fix docs 2025-01-16 23:00:21 +08:00
yyforyongyu
848f42ea1d
itest: fix flake in graph_topology_notifications
We need to make sure to wait for the `ListPeers` to give us the latest
response.
2025-01-16 16:19:37 +08:00
Nishant Bansal
3a3002e281
docs: add release notes.
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-01-15 19:46:09 +05:30
Nishant Bansal
23efbef946
itest: update tests with timeout_seconds
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-01-15 19:46:09 +05:30
Nishant Bansal
b577ad4661
routerrpc: default timeout_seconds to 60 in SendPaymentV2
If timeout_seconds is not set or is 0, the default value
of 60 seconds will be used.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-01-15 19:45:44 +05:30
Oliver Gugger
572784a6a1
Merge pull request #9390 from NishantBansal2003/append-channel
Enhance `lncli` listchannels command with the chan_id and short_chan_id (human readable format)
2025-01-15 07:19:27 -06:00
Nishant Bansal
c2897a4c78
docs: add release notes.
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-01-15 17:58:40 +05:30
Nishant Bansal
103a194e5c
cmd/lncli: update listchannels output fields
Added scid_str as a string representation of chan_id,
replacing chan_id with scid, and including chan_id(BOLT02)
in lncli listchannels output.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
2025-01-15 17:58:06 +05:30