Skip to content

multi: bump lnd to v0.21.3-beta - #260

Merged
guggero merged 5 commits into
lightninglabs:masterfrom
kaloudis:bump-lnd-v0.21
Sep 29, 2026
Merged

guggero merged 5 commits into
lightninglabs:masterfrom
kaloudis:bump-lnd-v0.21

Conversation

@kaloudis

@kaloudis kaloudis commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

chantools v0.14.x is built against lnd v0.19.0-beta, which knows channel DB schema versions up to 33. lnd v0.21.0 added version 35, so every read-write command fails on a DB last used by lnd v0.21.x:

[ERR] CHDB: Refusing to revert from db_version=35 to lower version=33
Error: error opening rescue DB: channel db cannot revert to prior version

Changes

  • go.mod: lnd v0.21.3-beta, loop v0.35.0-beta (brings lndclient v0.21.0-2), pool v0.7.1-beta. Go 1.25.13 is now required (CI GO_VERSION updated).
  • lnd/channeldb.go: graph DB is built with graphdb.NewKVStore and graphdb.NewChannelGraph(store).
  • lnd/chanbackup.go, lnd/brontide.go: adapted to changed chanbackup, discovery.Config and peer.Config APIs. The temporary graph DB for triggerforceclose is built from a graphdb.NewKVStore.
  • deletepayments: payments moved to payments/db, now uses paymentsdb.NewKVStore(...).DeletePayments.
  • dropchannelgraph: graph calls take a context and gossip version. Edges are built with models.NewV1Channel (the store rejects edges without GossipVersion1). ChannelGraph.Wipe was removed upstream, so a local wipeGraph deletes graph-node, graph-edge, graph-meta and closed-scid and re-creates them, like the old lnd code did.
  • lndVersion and generated docs say v0.21.3-beta.
  • Test fix: the pointer address regex in root_test.go only matched 10 hex digits, so TestCompactDBAndDumpChannels failed on darwin/arm64 (also on master).
  • zombierecovery_makeoffer.go: strings.Cut instead of strings.Split(...)[0]. This modernize finding also fails go tool golangci-lint run on master.

Behavior change

Read-write commands (migratedb, dropgraphzombies, dropchannelgraph, removechannel, deletepayments) now migrate older DBs to schema 35. After that the DB can't be opened by lnd older than v0.21.

Tested

  • go vet ./... clean, unit tests pass (itest not run).
  • go tool golangci-lint run (v2.6.2) and the v2.6.2 release binary used by CI (built with Go 1.25.3): 0 issues.
  • DB created at schema 35: old binary fails with the error above, new binary runs dropgraphzombies successfully.

Tested on a real node DB

  • dropgraphzombies on a channel.db from lnd v0.21.x
  • dropchannelgraph (full wipe, then lnd resyncs the graph)
  • dropchannelgraph --fix_only and --single_channel
  • deletepayments with and without --failedonly
  • chanbackup against the same DB
  • triggerforceclose (uses the lnd/brontide.go peer setup)
  • itest suite

Note: cmd/chantools/testdata/channel.db reports schema 20 but already contains the set-id-index bucket that migration 22 creates, so it can't be migrated read-write by either the old or the new binary. Not changed here.

Disclosure: built with assistance from Claude Opus 5.5

kaloudis and others added 5 commits September 27, 2026 22:45
lnd v0.21.0 added channel DB schema version 35. chantools built against
lnd v0.19.0-beta only knows versions up to 33 and refuses to open a DB
that was last used by lnd v0.21.x in read-write mode ("channel db cannot
revert to prior version").

This bumps lnd to v0.21.3-beta, loop to v0.35.0-beta (for a compatible
lndclient) and pool to v0.7.1-beta. lnd v0.21.3-beta requires Go 1.25.13.

API changes adapted to:
 - graphdb: the channel graph is created from a KVStore, StoreOptions
   replaces KVStoreOptions and ChannelGraph.Wipe was removed, so
   dropchannelgraph now deletes the graph buckets itself.
 - graph edges and policies need a gossip version, edges are built with
   models.NewV1Channel.
 - payments moved to the payments/db package.
 - chanbackup, discovery and peer config signature changes.
The address pattern only matched 10 hex digits, which is what Go uses on
linux/amd64. On darwin/arm64 heap addresses have 11 digits, so
TestCompactDBAndDumpChannels failed there because the dumps differed in
pointer values only.
Fixes a modernize lint error that also shows up on master when linting
with go tool golangci-lint.
This makes sure topology notifications are processed, which
prevents the dropchannelgraph command from hanging indefinitely
otherwise.
Add itest coverage for deletepayments, dropchannelgraph,
dropgraphzombies and removechannel sub commands.

@guggero guggero left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the update!
I've added some integration test coverage that actually found a small bug (see pushed commits). But now everything should be great, so LGTM 🌮

@guggero
guggero merged commit a8a09b6 into lightninglabs:master Sep 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants