lightninglabs / lightninglabs/lndinit

`migrate-db`: make defaults that match LND and document all defaults when running with `-h`

Open Beginner friendly
#75 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
37
Forks
18
Avg merge
1h 30m
Merged PRs (30d)
1

Description

Right now lndinit migrate-db has --dest.backend default to postgres:

https://github.com/lightninglabs/lndinit/blob/fb30cf3887a925755eb3118ff653f6a5bc6d9bf0/docs/data-migration.md?plain=1#L251

. This seems weird to me since we plan to make SQLite the default in future versions of LND. If we expect most users to use SQLite with LND, we should make it the default to encourage everyone to use that and not confuse them with the more complicated postgres option that only advanced users will use. Right now, if the user does not have a postgres server and they don't pass --dest.backend=sqlite, they get an error

2026-01-27 23:16:29.707 [INF]: LNDINIT Opening postgres backend at `` with prefix `channeldb`
2026-01-27 23:16:29.707 [ERR]: LNDINIT Runtime error: failed to open destination db with prefix `channeldb`: failed to connect to `host=/tmp user=zziigg database=`: dial error (dial unix /tmp/.s.PGSQL.5432: connect: no such file or directory)

Also, we have --source.bolt.data-dir and --dest.sqlite.data-dir. These have no defaults defined in the docs at:

.

I think they should match the default of LND, which is ~/.lnd/data so that most users don't need to pass any arguments to lndinit migrate-db. When testing, it seems they actually do, so we should document it.

We also have --chunk-size. This has no default defined in the CLI docs:

https://github.com/lightninglabs/lndinit/blob/fb30cf3887a925755eb3118ff653f6a5bc6d9bf0/docs/data-migration.md?plain=1#L240

.

It is defined in data-migration.md at

https://github.com/lightninglabs/lndinit/blob/fb30cf3887a925755eb3118ff653f6a5bc6d9bf0/docs/data-migration.md?plain=1#L128

but all users aren't going to know that from running

lndinit migrate-db -h

and could waste time trying to figure it out. Therefor, we should properly document that a default is actually defined.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the migrate-db CLI definitions and docs/data-migration.md, especially the entries for --dest.backend, --source.bolt.data-dir, --dest.sqlite.data-dir, and --chunk-size. Run lndinit migrate-db -h to compare the displayed defaults with LND's expected defaults. Done means SQLite and the LND data directories are represented correctly and every listed default appears in the help output and documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql, sqlite
Domain
cli, databases, documentation
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.