Commit graph

2170 commits

Author SHA1 Message Date
Viktor Torstensson
4ccb56a771
multi: add UpdateAccountAliasForTests query
In the upcoming kvdb to SQL migration of the actions store, we need to
simulate in tests that two or more accounts have colliding account
aliases for the first 4 bytes of the alias. In order to allow creation
of such accounts, we need to be able to update the alias of an account
in tests, and this commit adds the a SQL query enabling this
functionality.

Note that the `UpdateAccountAliasForTests` query is only intended for
use in tests and should not be used in production code.
2025-10-07 02:13:41 +02:00
Viktor Torstensson
5d8f03e241
sqlc+firewalldb: add GetAction SQL query
Add a new SQL query `GetAction` to retrieve a single action by its ID.
This query will be needed for the kvdb to SQL migration of actions
store.
2025-10-07 02:13:14 +02:00
Viktor Torstensson
c2c63cc241
Merge pull request #1146 from ViktorT-11/2025-09-actions-sql-store-persits-mac-rootkey-id
[sql-53] firewalldb: actions migration prep 2 - persist full macaroon root key ID in the SQL actions store
2025-10-03 12:04:19 +02:00
Viktor Torstensson
bd59605516
multi: add AddActionReq MacaroonId helper func
Add helper method to `AddActionReq` returns the 4 byte macaroon ID that
is derived from the MacaroonRootKeyID. Using the helper removes some
code repetition at call sites, and makes the intended usage clearer.
2025-10-03 11:44:05 +02:00
Viktor Torstensson
01bc36ca41
multi: remove AddActionReq MacaroonIdentifier
As the `MacaroonRootKeyID` field of the `AddActionReq` struct also
contains the 4 bytes of the `MacaroonIdentifier`, we change all
call sites to instead use the last 4 bytes of the `MacaroonRootKeyID`
field. As the `MacaroonIdentifier` field therefore becomes redundant,
we also remove it.
2025-10-03 11:44:05 +02:00
Viktor Torstensson
651cc678fc
multi: persist full mac root key in sql actions db
When migrating the actions store from kvdb to sql, we will update the
existing actions to include the full mac root key, instead of just the
last 4 bytes (currently called `MacaroonIdentifier`). In order to do so,
we change the sql implementation of the `actions` store to persist the
full mac root key, instead of just the last 4 bytes. As no production
data in the sql actions store exists for users yet, it's fine for us to
change this without having to address old sql actions which only stored
the last 4 bytes.

Note though that since old actions stored in the kvdb implementation
only have the last 4 bytes of the mac root key persisted, we will only
ever persist the last 4 byte of the mac root key ID for kvdb actions.
When the actions are later read back from the kvdb store, the first 4
bytes of the mac root key ID will be padded with zeroes to make up the
full 8 bytes.
As no call site currently utilizes the full 8 bytes of the mac root key
ID, this is okay for now. When we later deprecate and remove the kvdb
implementation, we can then update the rest of `litd` to also use the
full mac root key ID.
2025-10-03 11:44:04 +02:00
Viktor Torstensson
580ce701a2
firewalldb: update kvdb assertEqualActions
The upcoming commit will update the `AddActionReq` struct to include an
extra field which the `kvdb` actions store will ignore. Therefore the
`assertEqualActions` for the `kvdb` version will need to be update to
ignore this field. In preparation for that change, we also do another
optimization of the `assertEqualActions` function under kvdb builds, to
not mutate the passed action references.
2025-10-03 11:43:57 +02:00
Viktor Torstensson
f9006605ae
Merge pull request #1149 from lightninglabs/dependabot/npm_and_yarn/app/tar-fs-2.1.4
build(deps): bump tar-fs from 2.1.3 to 2.1.4 in /app
2025-10-03 11:29:15 +02:00
Viktor Torstensson
121c971a12
Merge pull request #1134 from ViktorT-11/2025-08-session-migration-deleted-account-fix
[sql-51] session: handle removed linked account
2025-09-29 13:53:37 +02:00
dependabot[bot]
a54c0542a4
build(deps): bump tar-fs from 2.1.3 to 2.1.4 in /app
Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 2.1.3 to 2.1.4.
- [Commits](https://github.com/mafintosh/tar-fs/compare/v2.1.3...v2.1.4)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-version: 2.1.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-26 19:55:20 +00:00
Viktor Torstensson
b4b36f653f
session: handle removed linked account
If a user creates a session linked to an account, but later deletes that
account using the `litcli accounts remove` command, the KVDB session
will still contain the account ID of the removed account.

During the KVDB to SQL migration, the accounts migration runs before the
sessions migration. Since the deleted account no longer exists, it
cannot be migrated. As a result, the migrated SQL session cannot link to
the now non-existent account in the SQL store.

In such cases, we will migrate the session and not link to any account
in the SQL session.
2025-09-26 20:46:50 +02:00
Elle
ef3bf2b2e0
Merge pull request #1148 from lightninglabs/dependabot/go_modules/perms/github.com/go-viper/mapstructure/v2-2.4.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /perms
2025-09-23 15:25:02 +02:00
dependabot[bot]
5cd43f1e03
build(deps): bump github.com/go-viper/mapstructure/v2 in /perms
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-23 10:52:05 +00:00
Elle
11b609c9b9
Merge pull request #1147 from lightninglabs/dependabot/go_modules/tools/github.com/go-viper/mapstructure/v2-2.4.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /tools
2025-09-23 12:51:01 +02:00
dependabot[bot]
5c15ef1ec3
build(deps): bump github.com/go-viper/mapstructure/v2 in /tools
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-18 11:38:13 +00:00
George Tsagkarelis
628ffb4ffd
Merge pull request #1144 from GeorgeTsagk/bump-go-1.24.6
build: bump go to v1.24.6
2025-09-18 13:37:16 +02:00
George Tsagkarelis
69ca6587b7
build: bump go to v1.24.6 2025-09-18 12:05:28 +02:00
George Tsagkarelis
3ccfc5231b
multi: prepare for new non-constant string rule
In preparation for the next commit which bumps golang to a newer
version, we want to make some code changes that would otherwise render
some log-related calls problematic. With go1.24 a new govet rule was
added that disallows non-constant strings (i.e including a tag like
"%s") in calls to printf. See more in the related issue
https://github.com/golang/go/issues/60529.
2025-09-18 12:05:28 +02:00
Elle
bce4c049a9
Merge pull request #1133 from ViktorTigerstrom/2025-08-session-migration-duplicate-id-fix
[sql-50] session migration duplicate ID fix
2025-09-02 16:20:37 +02:00
Elle
64f56dc930
Merge pull request #1126 from ViktorTigerstrom/2025-08-actions-migration-prep
[sql-47] Actions migration prep
2025-09-02 16:16:13 +02:00
Viktor Tigerström
3ca5e7de9a
Merge pull request #1140 from lightninglabs/dependabot/go_modules/litrpc/github.com/go-viper/mapstructure/v2-2.4.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0 in /litrpc
2025-09-01 14:56:59 +02:00
dependabot[bot]
96275e8be6
build(deps): bump github.com/go-viper/mapstructure/v2 in /litrpc
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-01 10:01:11 +00:00
Viktor Tigerström
3700cb4542
terminal: separate basic and full LND client setup
In the upcoming actions migration, we will need to fetch LND's macaroons
prior creating litd's stores, and therefore we need to connect to LND
prior to creating the stores.

To avoid having to wait for LND to fully sync before creating the stores
(and, by extension, Litd's RPC servers), we separate the basic LND
client setup from the full LND client setup. Only the full setup
requires a fully synced LND.
2025-09-01 10:30:20 +02:00
Viktor Tigerström
a779761f5c
terminal: setup LND prior to stores
In the upcoming actions migration, we need fetch LNDs macaroons prior to
initializing the stores, as the macaroons will be required during the
migration.

This requires that we setup the connection to LND before we initialize
the stores, as we can only fetch the macaroons after the LND connection
is established.

This commit refactors the litd startup process, so that the stores are
initialized after the LND connection is established.
2025-09-01 10:30:19 +02:00
Viktor Tigerström
9e9140e197
terminal: separate session RPC server init & start
Similar to how the previous commit separated the initialization and
starting of the account RPC server, this commit separates the
initialization and starting of the sessions RPC server.
2025-09-01 10:30:19 +02:00
Viktor Tigerström
d52b4565f2
multi: separate account RPC server init & start
In the upcoming actions migration, we need fetch LNDs macaroons prior to
initializing the stores, as the macaroons will be required during the
migration.

This requires that we setup the connection to LND before we initialize
the stores, as we can only fetch the macaroons after the LND connection
is established.

In preparation of doing so, we cannot reference the stores when
initializing/creating the accounts RPC server object, as we do so prior
to setting up the LND connection.

This commit therefore refactors the accounts RPC server so that we
separate the initializing from the starting of the RPC server, and only
require the store reference during the actual startup of the RPC server.

Note that we still keep the init of the accounts RPC server reference
prior to setting up the LND connection, as not doing so would require
that we'd refactor the registering of `GrpcSubserver`s in a more complex
and in a less elegant way.
2025-09-01 10:30:19 +02:00
Elle
de4b42129c
Merge pull request #1136 from lightninglabs/dependabot/go_modules/github.com/go-viper/mapstructure/v2-2.4.0
build(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2.4.0
2025-09-01 07:27:45 +01:00
Viktor Tigerström
911f8cae52
Merge pull request #1137 from ViktorTigerstrom/2025-08-lit-v0_15_2
Prepare for release of `v0.15.2-alpha` final
2025-08-22 15:31:12 +02:00
Viktor Tigerström
dddbf878c9
version: bump version to v0.15.2-alpha 2025-08-21 17:36:47 +02:00
Viktor Tigerström
ce5dbc01be
docs: update release notes 2025-08-21 17:36:47 +02:00
Viktor Tigerström
bf82c24c15
README: update for release of v0.15.2-alpha 2025-08-21 17:36:47 +02:00
Viktor Tigerström
b0a32f525f
terminal: bump lnd to v0.19.3-beta 2025-08-21 17:34:24 +02:00
Viktor Tigerström
4c0d71705d
perms: bump lnd to v0.19.3-beta 2025-08-21 17:33:53 +02:00
Viktor Tigerström
d3b1827d34
litrpc: bump lnd to v0.19.3-beta 2025-08-21 17:31:01 +02:00
dependabot[bot]
7e93d038a2
build(deps): bump github.com/go-viper/mapstructure/v2
Bumps [github.com/go-viper/mapstructure/v2](https://github.com/go-viper/mapstructure) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/go-viper/mapstructure/releases)
- [Changelog](https://github.com/go-viper/mapstructure/blob/main/CHANGELOG.md)
- [Commits](https://github.com/go-viper/mapstructure/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/go-viper/mapstructure/v2
  dependency-version: 2.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-21 15:03:16 +00:00
Viktor Tigerström
a79187f84e
terminal: add clarifying comment for LND startup
As it's quite confusing by just looking at `litd` codebase that LND will
execute `litd`'s `RegisterGrpcSubserver` function during the setup of
the LND connection, we add a comment to clarify this.
2025-08-21 16:33:37 +02:00
Viktor Tigerström
dfe0fa8b07
session: handle multiple sessions with the same ID
The logic to avoid duplicate session IDs was first added with the
session linking linking functionality. That means that there may be old
legacy sessions that were added prior to that which may have duplicate
IDs. Before this commit, such sessions would cause the kvdb to SQL
migration to error, as there is a uniqueness constraint on the legacy
session alias in the SQL sessions table.

We want to keep that constraint, so in such rare cases, we update the
kvdb to SQL migration logic to drop all but the session with the
latest CreatedAt time if for sessions that share the same ID.
That follows the logic in c8b78bd10d as
closely as possible, as that migration ensured that all sessions but the
latest one was revoked if multiple sessions shared the same ID.
2025-08-21 16:03:31 +02:00
Viktor Tigerström
a9c93663b3
Merge pull request #1129 from ViktorTigerstrom/2025-08-session-migration-ceavat-order-fix
[sql-48] session: sort MacaroonRecipe.caveats in migration
2025-08-20 13:54:01 +02:00
Viktor Tigerström
2d3564b36b
session: add expected results to migration tests
In the upcoming commit, we will update the kvdb to sql migration to not
always include all sessions in the kvdb store. Therefore, we update the
kvdb to migration tests in order to be able to handle such cases by
including the expected results for each test case.
2025-08-19 23:22:15 +02:00
Viktor Tigerström
1af12f4fb9
session: sort MacaroonRecipe.Permissions in migration
Similar to the previous commit, we also sort the
`MacaroonRecipe.Permissions` slice to ensure it can be compared in a
deterministic manner during migrations.
2025-08-15 17:19:23 +02:00
Oliver Gugger
f71840eafb
Merge pull request #1130 from lightninglabs/lnd-19-3-rc1
release: prepare for v0.15.2-alpha.rc1 that contains lnd v0.19.3-alpha.rc1
2025-08-11 00:42:47 -06:00
Oliver Gugger
4cce801fa4
version: bump version to v0.15.2-alpha.rc1 2025-08-08 15:32:43 +02:00
Oliver Gugger
f624566fb9
docs: update release notes 2025-08-08 15:32:43 +02:00
Oliver Gugger
278313dc34
README: update for release of v0.15.2-alpha.rc1 2025-08-08 15:32:43 +02:00
Oliver Gugger
07f6f2a034
mod: bump lnd to v0.19.3-beta.rc1 2025-08-08 15:32:43 +02:00
Oliver Gugger
cb29ba06ee
tools: bump Golang minimum version 2025-08-08 15:28:31 +02:00
Oliver Gugger
04907b6b38
Merge pull request #1128 from lightninglabs/go-1.23.12
build: bump go version to 1.23.12
2025-08-08 07:22:43 -06:00
Viktor Tigerström
d3eb3cd3fc
session: sort MacaroonRecipe.caveats in migration
In the kvdb to sql migration, if there have been caveats set for the
MacaroonRecipe, the order of the postgres db caveats will in very rare
cases differ from the kv store caveats. Therefore, we sort both the kv
and sql caveats by their ID, so that we can compare them in a
deterministic way.
2025-08-07 15:54:16 +02:00
Elle Mouton
eb1d081314
build: bump go version to 1.23.12 2025-08-07 11:10:39 +02:00
Oliver Gugger
ef87c7a609
Merge pull request #1120 from bitcoin-coder-bob/testnet4-network-option
network flag to support testnet4
2025-07-31 01:24:24 -06:00