Commit graph

2492 commits

Author SHA1 Message Date
Viktor Torstensson
1903010be5
Merge pull request #1320 from ViktorT-11/2026-06-cut-v0_17_rc1
Some checks failed
CI / frontend tests on macOS-latest (push) Has been cancelled
CI / frontend tests on ubuntu-latest (push) Has been cancelled
CI / frontend tests on windows-latest (push) Has been cancelled
CI / backend build on macOS-latest (push) Has been cancelled
CI / backend build on ubuntu-latest (push) Has been cancelled
CI / backend build on windows-latest (push) Has been cancelled
CI / cross compilation (push) Has been cancelled
CI / cross compilation-1 (push) Has been cancelled
CI / cross compilation-2 (push) Has been cancelled
CI / RPC proto compilation check (push) Has been cancelled
CI / check commits (push) Has been cancelled
CI / Sqlc check (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / run unit tests (push) Has been cancelled
CI / run unit tests-1 (push) Has been cancelled
CI / run unit tests-2 (push) Has been cancelled
CI / run unit tests-3 (push) Has been cancelled
CI / build itest binaries (push) Has been cancelled
CI / check release notes updated (push) Has been cancelled
CI / integration test (push) Has been cancelled
CI / integration test-1 (push) Has been cancelled
CI / integration test-2 (push) Has been cancelled
Prepare for litd `v0.17.0-alpha.rc1` release
2026-06-09 20:31:35 +02:00
Viktor Torstensson
6f89357c35
version: bump version to v0.17.0-alpha.rc1 2026-06-09 18:33:38 +02:00
Viktor Torstensson
782113f36b
docs: prepare release notes for v0.17.0-alpha.rc1 2026-06-09 18:33:38 +02:00
Viktor Torstensson
4b6b445dd7
migsets: increase maxListMacaroonIDAttempts to 120
Due to that certain wallet setups, such as `lnd.noseedbackup`, can take
a bit of time to open the `lnd` wallet, we need to increase the time we
allow for the RPC call which lists the macaroon IDs.

We therefore allow up to 60 seconds instead of 5 seconds for that to
happen, to ensure that the kvdb->SQL migration doesn't fail in such
setups.
2026-06-09 18:33:38 +02:00
Viktor Torstensson
acc578770a
Merge pull request #1315 from ViktorT-11/2026-05-prompt-user-when-migrating
Some checks are pending
CI / frontend tests on macOS-latest (push) Waiting to run
CI / frontend tests on ubuntu-latest (push) Waiting to run
CI / frontend tests on windows-latest (push) Waiting to run
CI / backend build on macOS-latest (push) Waiting to run
CI / backend build on ubuntu-latest (push) Waiting to run
CI / backend build on windows-latest (push) Waiting to run
CI / cross compilation (push) Waiting to run
CI / cross compilation-1 (push) Waiting to run
CI / cross compilation-2 (push) Waiting to run
CI / RPC proto compilation check (push) Waiting to run
CI / check commits (push) Waiting to run
CI / Sqlc check (push) Waiting to run
CI / lint (push) Waiting to run
CI / run unit tests (push) Waiting to run
CI / run unit tests-1 (push) Waiting to run
CI / run unit tests-2 (push) Waiting to run
CI / run unit tests-3 (push) Waiting to run
CI / build itest binaries (push) Waiting to run
CI / integration test (push) Blocked by required conditions
CI / integration test-1 (push) Blocked by required conditions
CI / integration test-2 (push) Blocked by required conditions
CI / check release notes updated (push) Waiting to run
[sql-71] Prompt user before starting KVDB -> SQL migration
2026-06-08 21:36:39 +02:00
Viktor Torstensson
69d875742e
docs: add release note entry for migration prompt 2026-06-08 21:11:51 +02:00
Viktor Torstensson
371d22ad8e
terminal: enable skipping migration prompt
Add a config option and env variable which allows users to skip the
migration confirmation prompt. This is useful for users who which are
running in a non-interactive environment, and does not have access to
pass input to stdin.
2026-06-08 21:11:51 +02:00
Viktor Torstensson
9016bbb3d2
multi: confirm kvdb migration at startup
Prompt before automatically migrating legacy kvdb state to SQL when
litd starts with a SQL backend and active bbolt data is still present.

Detect prior migrations by checking for the SQL tombstone marker so
already-migrated stores can start without prompting. Add unit coverage
for the prompt flow and wire stdin through the itest harness so the
migration restart path can acknowledge the prompt automatically.
2026-06-08 21:11:51 +02:00
Viktor Torstensson
f5046d1f4e
Merge pull request #1305 from ViktorT-11/2026-05-sql-migration-in-prod
[sql-70] Enable SQL backends in production & trigger the kvdb to sql migration
2026-06-08 21:08:16 +02:00
Viktor Torstensson
c9192f3318
Merge pull request #1300 from lightninglabs/bump-lnd-v0.21-tapd-v0.8
multi: bump lnd to v0.21, taproot-assets to v0.8
2026-06-08 20:59:30 +02:00
Viktor Torstensson
58e0c1e3ac
Merge pull request #1319 from ViktorT-11/2026-06-sql-table-fixes
[sql-72] Preserve SQL ordering and uniqueness parity with kvdb
2026-06-08 20:16:49 +02:00
Calvin Zachman
fac7c42ee7
docs: add release note for dependency bump 2026-06-08 13:19:23 -04:00
Calvin Zachman
b225a8de85
multi: regenerate protos and update frontend test data
Run make rpc to regenerate JS/TS protobuf files for lnd v0.21.
The proto file drops the removed deprecated RPCs (SendPayment,
SendPaymentSync, SendToRoute, SendToRouteSync) and picks up new
messages and fields (onion messages, ChannelCommitUpdate,
walletSynced, graphCacheStatus, etc.). The frontend test sample data
is updated to include the new GetInfoResponse, WaitingCloseChannel,
and ChannelEventUpdate fields.
2026-06-08 13:19:14 -04:00
Calvin Zachman
862c1dba9d
multi: bump lnd, lndclient, and taproot-assets dependencies
Bumps lnd to v0.21.0-beta, lndclient to v0.21.0-1, and
taproot-assets to v0.8.0 across the root, litrpc, and perms
modules. taprpc uses the proper v1.1.0 tag.

lnd removed the deprecated SendPaymentSync, SendToRouteSync,
SendPayment (streaming), and SendToRoute (streaming) RPCs. The
account interceptor checkers and their tests for these RPCs are
removed since no client can call them anymore. The V2 checkers
already handle account tracking for payments.

The itest harness is updated for lnd v0.21's miner API changes
(SendOutputs -> SendOutput, Miner.Client.Generate -> GenerateBlocks,
waitForNTxsInMempool replaced by Miner.AssertNumTxsInMempool) and
TimeLockDelta bumped from 20 to 40 since lnd v0.21 raised
MinCLTVDelta from 18 to 24.
2026-06-08 13:18:37 -04:00
Viktor Torstensson
8912fc6455
sqlc: remove accidental "NOT" in actions migration 2026-06-08 17:21:03 +02:00
Viktor Torstensson
29b3a9b8db
session: guard nil migrated macaroon recipe
Initialize the migrated session's MacaroonRecipe before applying the
nil-perms and nil-caveats normalization used during migration
validation.

This is needed because the SQL store can represent a session with no
macaroon permission or caveat rows as a nil MacaroonRecipe, while the
KV store may still have a non-nil recipe wrapper. Without this guard,
overrideMacaroonRecipe can dereference a nil migrated recipe and panic
instead of letting the migration validation complete normally.

Using an empty MacaroonRecipe preserves the intended normalization
behavior for the nil/empty recipe cases while still allowing genuine
mismatches to fail through DeepEqual.
2026-06-08 17:21:03 +02:00
Viktor Torstensson
b61f62d7d9
multi: preserve macaroon recipe order in SQL
Store explicit positions for session macaroon caveats and permissions
in the SQL schema and read them back in position order. Also remove the
migration-time sorting workaround in session comparison, so migration
validation now checks the actual persisted order instead of masking it.

This is needed because session caveat order is not just presentation
data. LiT adds caveats to the baked macaroon in slice order, and the
macaroon library updates the signature hash chain for each added caveat.
Reordering caveats can therefore change the resulting macaroon bytes and
signature.

The previous schema split caveats and permissions into child tables
without any position column, and the SQL reads had no ORDER BY. The KV
store preserves slice order, but SQL had no explicit way to reproduce
that order after migration or on later reads. The migration code’s old
sorting step was only making validation deterministic; it did not
preserve the original recipe order.

Permissions are canonicalized by lnd when baking, so their order is less
semantically important for the final macaroon. They still get positions
here so the stored recipe remains faithful to the original session data
and both child tables behave consistently.

Why it was needed:

- caveats needed explicit order preservation because they are appended
  and signed in order.
- The old SQL schema did not store order, and the read queries did not
  request one.
- Adding position makes the SQL representation faithful to the KV/TLV
  recipe instead of relying on incidental row order.

- Adding it to permissions too keeps the stored recipe lossless and
  consistent, even though lnd. canonicalizes permissions before baking.

NOTE: This commit explicitly edits the previous migration instead of
adding a new one. This is ok as SQL dbs are not yet supported in
production, so there are no live deployments to worry about.
2026-06-08 17:21:03 +02:00
Viktor Torstensson
e955dc825b
multi: preserve action order across SQL migration
Migrate KV firewall actions by traversing the global actions-index
instead of iterating per-session buckets, so SQL action IDs follow the
same global creation order as the legacy KV store.

Also stabilize SQL action listing by ordering on created_at and id,
using id as a deterministic tie-breaker when multiple actions share the
same timestamp.

This is needed because KV actions have a real global sequence in
actions-index, while the old migration assigned SQL IDs based on bucket
traversal order. That could reorder legacy actions during migration.
Separately, ordering by created_at alone was not stable for equal
timestamps, so action queries could return different orders for the
same data.

NOTE: This commit explicitly edits the previous migration instead of
adding a new one. This is ok as SQL dbs are not yet supported in
production, so there are no live deployments to worry about.
2026-06-08 17:21:03 +02:00
Viktor Torstensson
2003a8b7f4
docs: add SQL migration release notes
Document the default KVDB-to-SQL migration in the 0.17.0 release
notes, including the new databasebackend option and the available
SQLite and Postgres backends.

Also note that users who want to remain on bbolt must set
databasebackend=bbolt before the SQL migration runs, since the legacy
bbolt database is tombstoned after a successful migration.

Mark the bbolt backend as deprecated and note that support will be
removed in a future release.
2026-06-08 11:23:59 +02:00
Viktor Torstensson
d1cc192434
multi: ensure kvdb -> SQL mig uses correct db folders
The kvdb accounts db is specifically set to be created in the same
folder as the macaroon path, while the sessions and rules db are created
in the network folder.

That means that users which have set a custom macaroon path, can have
an accounts db in a separate folder than the sessions and rules db.
In order to ensure that the migration from kvdb to SQL uses the correct
db folders, we need to make sure that the migration code uses the same
logic as the creation of the db logic.
2026-06-08 11:23:59 +02:00
Viktor Torstensson
93f6aa9e2c
terminal: add db config nil checks 2026-06-08 11:23:59 +02:00
Viktor Torstensson
b09fd2852a
terminal: create sqlite db directory from configured path
Create the SQLite database directory from
c.Sqlite.DatabaseFileName instead of the generic network directory.

This ensures startup uses the final validated SQLite path, including
cases where loadAndValidateConfig has already overridden the
database file location to point at the correct network-specific
directory.
2026-06-08 11:23:59 +02:00
Viktor Torstensson
a1283e3353
terminal: register SQL store cleanup before migrations
Move the SQLite and Postgres BaseDB close handlers to immediately
after the SQL store is created.

This ensures the cleanup function is registered even if the
subsequent migration or store initialization steps fail, avoiding
leaked SQL handles on early returns.
2026-06-08 11:23:59 +02:00
Viktor Torstensson
3da4a600fa
terminal: add NewStores to the Config struct
Make the `NewStores` function into a struct member of the `Config`
struct, as the choice of database backend is now part of the production
configuration.
2026-06-08 11:23:59 +02:00
Viktor Torstensson
68718a5c59
multi: Don't backup Sqlite database file on mig
As the SQL migrations prior to the kvdb to SQL migration was never live
in production, we can safely assume that the sql database is empty prior
to the kvdb to sql migration.

Therefore, it is not necessary that we create an backup of the sqlite
database for every migration that exists for the time being.
As the sqldb/v2 intentionally doesn't delete the backup file when a
migration has been completed (as this is intentional behaviour for tapd)
and the package so far doesn't support any option to delete the backup
file, this otherwise creates multiple unnecessary backup files for
users.

Once the sqldb/v2 does support making deletion of the backup file
possible, or once we add another sql migration, we need to toggle the
backup behaviour for the sql migrations on again.
2026-06-08 11:23:58 +02:00
Viktor Torstensson
d59e75514b
terminal: Make sqlite the default db backend
Change the default database backend from bbolt to SQLite now that SQL
backends are exposed through the main configuration path.

This will trigger the kvdb to SQL migration automatically for users who
have not specifically set their database backend to bbolt.

Note that once the kvdb to sql migration is complete, the user's bbolt
database will be tombstoned.
2026-06-08 11:23:58 +02:00
Viktor Torstensson
aabf8b08e9
terminal: remove DevConfig.Validate params
As the `DevConfig.Validate` params are no longer used in the Validate
method, we can remove them from the method signature.
2026-06-08 11:23:58 +02:00
Viktor Torstensson
66e9d3c46d
terminal: move databasebackend option to Config
Move the database backend selection from the `dev` config file into the
main `Config` struct, i.e. into production.

This will enable an sql database backend to be used in production.
2026-06-08 11:23:58 +02:00
Viktor Torstensson
10949c7bb8
db: remove kvdb to sql migration from dev db stream
Remove the KVDB-to-SQL migration from the dev SQL migration set now
that this migration is now part of the production migration set.

As the migrations_dev folder no longer contains any migrations, we also
update the db logic and the gen_sqlc_docker.sh script to not error when
the folder(s) are empty.
2026-06-08 11:23:58 +02:00
Viktor Torstensson
85d0739019
db: move kvdb to SQL programmatic migration to prod
Move the programmatic KVDB-to-SQL migration out of the dev-only
migration stream and into the production SQL migration set.

This also requires that we add a new migration file for the prod
migration, which will trigger the kvdb to sql programmatic migration to
run in production.
2026-06-08 11:23:58 +02:00
Viktor Torstensson
3d8779693a
migsets: rename post migration callbacks mentions
With the latest version of the `sqldb/v2` & `migrate` packages, Post
Migration Callbacks were renamed to Programmatic Migrations.
Our previous codebase still had some mentions of Post Migration
Callbacks, and therefore we rename those to use the word Programmatic
Migrations instead.
2026-06-08 11:23:57 +02:00
Viktor Torstensson
11115e7afa
multi: tighten kvstore namespace uniqueness
Replace the single kvstores UNIQUE index with namespace-specific partial
unique indexes and add a check that feature-scoped records always have
a group_id.

This is needed because the old uniqueness constraint covered nullable
columns. In SQL, NULL values do not compare equal inside a UNIQUE index,
so duplicate global and group-scoped kvstore rows could be inserted even
though the legacy KVDB bucket layout only allows one record per logical
namespace.

The new indexes mirror the KVDB model directly:
global rows are unique by entry_key, rule_id, and perm; group rows add
group_id; feature rows add feature_id. The CHECK constraint also blocks
invalid feature rows that are not attached to a group.

NOTE: This commit explicitly edits the previous migration instead of
adding a new one. This is ok as SQL dbs are not yet supported in
production, so there are no live deployments to worry about.
2026-06-05 01:06:22 +02:00
Viktor Torstensson
3e5f36c0b8
Merge pull request #1314 from lightninglabs/bump-pool-v0.7.1-beta
go.mod: bump pool to v0.7.1-beta
2026-05-25 19:02:04 +02:00
Jamal James
41012e4c58
Merge pull request #1311 from 0xfandom/fix/1022-dockerfile-worktree-gitkeep
app: make build/.gitkeep postbuild step git-worktree friendly
2026-05-22 10:57:48 -05:00
Olaoluwa Osuntokun
0b34078d8a docs: add v0.7.1-beta pool bump to 0.17.0 release notes 2026-05-21 20:40:17 -07:00
Olaoluwa Osuntokun
b44a972fcd go.mod: bump pool to v0.7.1-beta
In this commit, we bump the embedded pool dependency to v0.7.1-beta,
which pulls in the partial re-subscribe fix from lightninglabs/pool#521.
Before, a single per-account failure in HandleServerShutdown would bail
the whole re-subscribe loop and silently leave the remaining accounts
un-subscribed (and filtered as offline at matching time) until the
trader process restarted.

The loop is now best-effort: per-account errors are logged with the
trader key, every account still gets a re-subscribe attempt, and the
aggregated error is returned to the caller via errors.Join so we don't
lose the signal.
2026-05-21 20:39:32 -07:00
Viktor Torstensson
767c6e83fb
Merge pull request #1303 from Cyberguru1/depreciate-new-balance
litcli: remove deprecated new_balance flag from update command
2026-05-21 14:35:50 +02:00
cyberguru1
334a2adeb1
docs: add release notes for removal of deprecated new_balance
Document new_balance removal, expiration date defaulting fixes, and
updated contributors.
2026-05-21 06:21:32 -05:00
Viktor Torstensson
00a2bc8533
Merge pull request #1313 from lightninglabs/bump-pool-v0.7.0-beta
go.mod: bump pool to v0.7.0-beta
2026-05-21 10:56:54 +02:00
Olaoluwa Osuntokun
26d858994b docs: add v0.7.0-beta pool bump to 0.17.0 release notes 2026-05-20 15:45:35 -07:00
Olaoluwa Osuntokun
e970107f18 go.mod: bump pool to v0.7.0-beta
Updates the embedded pool dependency to v0.7.0-beta, which brings in the
auctioneer EOF reconnect and jittered backoff fixes (#518) and the
pending-open-channel stream handling fix (#507), along with the usual
round of transitive dependency bumps.
2026-05-20 15:45:07 -07:00
Elle
e47348680f
Merge pull request #1257 from lightninglabs/dependabot/go_modules/perms/google.golang.org/grpc-1.79.3
build(deps): bump google.golang.org/grpc from 1.67.0 to 1.79.3 in /perms
2026-05-19 17:29:57 -07:00
Elle
5c78d4c96a
Merge pull request #1310 from ViktorT-11/2026-05-use-fillPlaceHolders-in-CountActions
[sql-73] use `fillPlaceHolders` in `CountActions`
2026-05-19 17:29:14 -07:00
Elle
4af5788819
Merge pull request #1309 from ViktorT-11/2026-05-add-master-additions-to-migration-code
[sql-72] Add `master` additions to migration code
2026-05-19 17:28:45 -07:00
Viktor Torstensson
36eb65c526
Merge pull request #1312 from ViktorT-11/2026-05-sql-migration-fixes
[sql-74] Handle empty VerificationIDs for sessions & normalize action timestamp handling to UTC
2026-05-19 11:54:47 +02:00
Viktor Torstensson
0f31fb594b
Merge pull request #1301 from ViktorT-11/2026-05-improve-migration-progress-logging
[sql-69] multi: improve kvdb migration progress logging
2026-05-19 11:54:05 +02:00
Viktor Torstensson
d9d5432a10
firewalldb: canonicalize action timestamps to UTC
Normalize action timestamp handling to UTC during KV and SQL
marshalling so migration validation behaves consistently on
Postgres backends outside UTC.

This also allows the action time comparison helper to use the
same timezone normalization approach as the other migration
paths.
2026-05-19 11:27:12 +02:00
Viktor Torstensson
7b3916596f
session: cover empty caveat verification ids
Add migration coverage for nested empty caveat verification IDs
and normalize the migrated SQL representation so empty byte
slices compare consistently with the KV store.
2026-05-19 11:27:12 +02:00
Viktor Torstensson
2f5de800c8
multi: improve kvdb migration progress logging
Add clearer progress logging across the KVDB to SQL migration paths
for accounts, sessions, and firewalldb.

Log the total number of items to migrate where it is cheap to
determine up front, and emit progress updates every 100 migrated
items.
2026-05-19 11:22:45 +02:00
Viktor Torstensson
ebd7ac39c6
Merge pull request #1308 from lightninglabs/sql-migration-base
[sql-71] Merge `sql-migration-base` into `master`
2026-05-19 10:54:52 +02:00