Repository: lightningnetwork/lnd
Pull request #9684 (2025-04-07 22:46:12)

multi: update new walletdb version in main go.mod and kvdb go.mod
Updated to the new walletdb/v1.5.0 with the option to open a bbolt db in readonly. This changes needs to be done thorougly because the error will only be seen at runtime. Tried my best to filter all the postions where we use it. But a second pair of eyes would be very good.

After this change: the kvdb package needs to be tagged, then it could be used in the lndinit tool.

https://github.com/lightninglabs/lndinit/pull/21


EDIT:

Also bumped btcwallet version.

coderabbitai[bot]: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- This is an auto-generated comment: skip review by coderabbit.ai -->

> [!IMPORTANT]
> ## Review skipped
> 
> Auto reviews are limited to specific labels.
> 
> <details>
> <summary>:label: Labels to auto review (1)</summary>
> 
> * llm-review
> 
> </details>
> 
> Please check the settings in the CodeRabbit UI or the `.coderabbit.yaml` file in this repository. To trigger a single review, invoke the `@coderabbitai review` command.
> 
> You can disable this status message by setting the `reviews.review_status` to `false` in the CodeRabbit configuration file.

<!-- end of auto-generated comment: skip review by coderabbit.ai -->
<!-- tips_start -->

---

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=lightningnetwork/lnd&utm_content=9684):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai plan` to trigger planning for file edits and PR creation.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
guggero: The wallet loader also needs to be updated, which means we need https://github.com/btcsuite/btcwallet/pull/998 first.

Patch:
diff --git a/channeldb/migration_01_to_11/db.go b/channeldb/migration_01_to_11/db.go
index 65cc8d221..4045d52bd 100644
--- a/channeldb/migration_01_to_11/db.go
+++ b/channeldb/migration_01_to_11/db.go
@@ -57,7 +57,7 @@ func Open(dbPath string, modifiers ...OptionModifier) (*DB, error) {
 	// freelist grows to be very large.
 	bdb, err := kvdb.Open(
 		kvdb.BoltBackendName, path,
-		opts.NoFreelistSync, opts.DBTimeout,
+		opts.NoFreelistSync, opts.DBTimeout, false,
 	)
 	if err != nil {
 		return nil, err
@@ -89,6 +89,7 @@ func createChannelDB(dbPath string) error {
 	path := filepath.Join(dbPath, dbName)
 	bdb, err := kvdb.Create(
 		kvdb.BoltBackendName, path, false, kvdb.DefaultDBTimeout,
+		false,
 	)
 	if err != nil {
 		return err
diff --git a/config_builder.go b/config_builder.go
index d4106a0ab..8db209393 100644
--- a/config_builder.go
+++ b/config_builder.go
@@ -1474,7 +1474,8 @@ func initNeutrinoBackend(ctx context.Context, cfg *Config, chainDir string,
 	default:
 		dbName := filepath.Join(dbPath, "neutrino.db")
 		db, err = walletdb.Create(
-			"bdb", dbName, !cfg.SyncFreelist, cfg.DB.Bolt.DBTimeout,
+			kvdb.BoltBackendName, dbName, !cfg.SyncFreelist,
+			cfg.DB.Bolt.DBTimeout, false,
 		)
 	}
 	if err != nil {
diff --git a/go.mod b/go.mod
index 58959279b..496b5a613 100644
--- a/go.mod
+++ b/go.mod
@@ -11,11 +11,11 @@ require (
 	github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0
 	github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c
 	github.com/btcsuite/btclog/v2 v2.0.1-0.20250110154127-3ae4bf1cb318
-	github.com/btcsuite/btcwallet v0.16.12
+	github.com/btcsuite/btcwallet v0.16.13-0.20250409141346-8e790bfb5832
 	github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5
 	github.com/btcsuite/btcwallet/wallet/txrules v1.2.2
-	github.com/btcsuite/btcwallet/walletdb v1.4.4
-	github.com/btcsuite/btcwallet/wtxmgr v1.5.4
+	github.com/btcsuite/btcwallet/walletdb v1.5.1
+	github.com/btcsuite/btcwallet/wtxmgr v1.5.5
 	github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
 	github.com/davecgh/go-spew v1.1.1
 	github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
@@ -216,3 +216,5 @@ replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-d
 go 1.23.6
 
 retract v0.0.2
+
+replace github.com/lightningnetwork/lnd/kvdb => ./kvdb
diff --git a/go.sum b/go.sum
index 445f10f1b..abc47df9d 100644
--- a/go.sum
+++ b/go.sum
@@ -62,18 +62,18 @@ github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c/go.mod h1:w7xnGOhw
 github.com/btcsuite/btclog/v2 v2.0.1-0.20250110154127-3ae4bf1cb318 h1:oCjIcinPt7XQ644MP/22JcjYEC84qRc3bRBH0d7Hhd4=
 github.com/btcsuite/btclog/v2 v2.0.1-0.20250110154127-3ae4bf1cb318/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE=
 github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
-github.com/btcsuite/btcwallet v0.16.12 h1:9SREKY892i1xTGlGLcu6x7O+WSQFn6+uQrSuskAOqh0=
-github.com/btcsuite/btcwallet v0.16.12/go.mod h1:jBn+ThFrx/QqW0nXiGvXtJytju4aVoW7C0hY4s/+9vo=
+github.com/btcsuite/btcwallet v0.16.13-0.20250409141346-8e790bfb5832 h1:Nd5r1YDNN47hn2UVyOcIJjNRvA90bpUrSVp8wnPMa18=
+github.com/btcsuite/btcwallet v0.16.13-0.20250409141346-8e790bfb5832/go.mod h1:Lpr6jNoTiWlgaXqFP+ar2YWSiD6Fl8xlh99WPvuErS4=
 github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 h1:Rr0njWI3r341nhSPesKQ2JF+ugDSzdPoeckS75SeDZk=
 github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5/go.mod h1:+tXJ3Ym0nlQc/iHSwW1qzjmPs3ev+UVWMbGgfV1OZqU=
 github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 h1:YEO+Lx1ZJJAtdRrjuhXjWrYsmAk26wLTlNzxt2q0lhk=
 github.com/btcsuite/btcwallet/wallet/txrules v1.2.2/go.mod h1:4v+grppsDpVn91SJv+mZT7B8hEV4nSmpREM4I8Uohws=
 github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 h1:93o5Xz9dYepBP4RMFUc9RGIFXwqP2volSWRkYJFrNtI=
 github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5/go.mod h1:lQ+e9HxZ85QP7r3kdxItkiMSloSLg1PEGis5o5CXUQw=
-github.com/btcsuite/btcwallet/walletdb v1.4.4 h1:BDel6iT/ltYSIYKs0YbjwnEDi7xR3yzABIsQxN2F1L8=
-github.com/btcsuite/btcwallet/walletdb v1.4.4/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs=
-github.com/btcsuite/btcwallet/wtxmgr v1.5.4 h1:hJjHy1h/dJwSfD9uDsCwcH21D1iOrus6OrI5gR9E/O0=
-github.com/btcsuite/btcwallet/wtxmgr v1.5.4/go.mod h1:lAv0b1Vj9Ig5U8QFm0yiJ9WqPl8yGO/6l7JxdHY1PKE=
+github.com/btcsuite/btcwallet/walletdb v1.5.1 h1:HgMhDNCrtEFPC+8q0ei5DQ5U9Tl4RCspA22DEKXlopI=
+github.com/btcsuite/btcwallet/walletdb v1.5.1/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs=
+github.com/btcsuite/btcwallet/wtxmgr v1.5.5 h1:VA/rHzAjiNuySPcKgdX3uAywbVczZlG5OZeSU7jYoZo=
+github.com/btcsuite/btcwallet/wtxmgr v1.5.5/go.mod h1:lzVbDkk/jRao2ib5kge46aLZW1yFc8RFNycdYpnsmZA=
 github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw=
 github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
 github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc=
@@ -371,8 +371,6 @@ github.com/lightningnetwork/lnd/fn/v2 v2.0.8 h1:r2SLz7gZYQPVc3IZhU82M66guz3Zk2oY
 github.com/lightningnetwork/lnd/fn/v2 v2.0.8/go.mod h1:TOzwrhjB/Azw1V7aa8t21ufcQmdsQOQMDtxVOQWNl8s=
 github.com/lightningnetwork/lnd/healthcheck v1.2.6 h1:1sWhqr93GdkWy4+6U7JxBfcyZIE78MhIHTJZfPx7qqI=
 github.com/lightningnetwork/lnd/healthcheck v1.2.6/go.mod h1:Mu02um4CWY/zdTOvFje7WJgJcHyX2zq/FG3MhOAiGaQ=
-github.com/lightningnetwork/lnd/kvdb v1.4.14 h1:VALUyoBCFKQm/3GAIdTIoUGplWBfZbo5uCr7BTY9QZY=
-github.com/lightningnetwork/lnd/kvdb v1.4.14/go.mod h1:1y0Z81CGQu4SMpcnAie/oK4tzgEqFQqFdj6k3fz2s8s=
 github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI=
 github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4=
 github.com/lightningnetwork/lnd/sqldb v1.0.9 h1:7OHi+Hui823mB/U9NzCdlZTAGSVdDCbjp33+6d/Q+G0=
diff --git a/kvdb/backend.go b/kvdb/backend.go
index e42c02233..269d5d821 100644
--- a/kvdb/backend.go
+++ b/kvdb/backend.go
@@ -73,6 +73,10 @@ type BoltBackendConfig struct {
 	// DBTimeout specifies the timeout value to use when opening the wallet
 	// database.
 	DBTimeout time.Duration
+
+	// ReadOnly specifies if the database should be opened in read-only
+	// mode.
+	ReadOnly bool
 }
 
 // GetBoltBackend opens (or creates if doesn't exits) a bbolt backed database
@@ -90,7 +94,7 @@ func GetBoltBackend(cfg *BoltBackendConfig) (Backend, error) {
 
 		return Create(
 			BoltBackendName, dbFilePath,
-			cfg.NoFreelistSync, cfg.DBTimeout,
+			cfg.NoFreelistSync, cfg.DBTimeout, cfg.ReadOnly,
 		)
 	}
 
@@ -104,7 +108,7 @@ func GetBoltBackend(cfg *BoltBackendConfig) (Backend, error) {
 
 	return Open(
 		BoltBackendName, dbFilePath,
-		cfg.NoFreelistSync, cfg.DBTimeout,
+		cfg.NoFreelistSync, cfg.DBTimeout, cfg.ReadOnly,
 	)
 }
 
@@ -294,6 +298,7 @@ func GetTestBackend(path, name string) (Backend, func(), error) {
 			DBFileName:     name,
 			NoFreelistSync: true,
 			DBTimeout:      DefaultDBTimeout,
+			ReadOnly:       false,
 		})
 		if err != nil {
 			return nil, nil, err
diff --git a/kvdb/backend_js.go b/kvdb/backend_js.go
index f1774408d..23dc0b2ea 100644
--- a/kvdb/backend_js.go
+++ b/kvdb/backend_js.go
@@ -35,6 +35,10 @@ type BoltBackendConfig struct {
 	// DBTimeout specifies the timeout value to use when opening the wallet
 	// database.
 	DBTimeout time.Duration
+
+	// ReadOnly specifies if the database should be opened in read-only
+	// mode.
+	ReadOnly bool
 }
 
 // GetBoltBackend opens (or creates if doesn't exits) a bbolt backed database
diff --git a/kvdb/bolt_fixture.go b/kvdb/bolt_fixture.go
index 0ac54b55f..fc3ca1a17 100644
--- a/kvdb/bolt_fixture.go
+++ b/kvdb/bolt_fixture.go
@@ -28,6 +28,7 @@ func (b *boltFixture) NewBackend() walletdb.DB {
 		DBFileName:     "test.db",
 		NoFreelistSync: true,
 		DBTimeout:      DefaultDBTimeout,
+		ReadOnly:       false,
 	})
 	require.NoError(b.t, err)
 
diff --git a/kvdb/go.mod b/kvdb/go.mod
index 646c1691e..b18fe0870 100644
--- a/kvdb/go.mod
+++ b/kvdb/go.mod
@@ -2,7 +2,7 @@ module github.com/lightningnetwork/lnd/kvdb
 
 require (
 	github.com/btcsuite/btclog/v2 v2.0.0-20241017175713-3428138b75c7
-	github.com/btcsuite/btcwallet/walletdb v1.4.4
+	github.com/btcsuite/btcwallet/walletdb v1.5.1
 	github.com/davecgh/go-spew v1.1.1
 	github.com/fergusstrange/embedded-postgres v1.25.0
 	github.com/google/btree v1.0.1
diff --git a/kvdb/go.sum b/kvdb/go.sum
index ba8f6edaf..5dce9ab8a 100644
--- a/kvdb/go.sum
+++ b/kvdb/go.sum
@@ -42,8 +42,8 @@ github.com/btcsuite/btclog v0.0.0-20241003133417-09c4e92e319c/go.mod h1:w7xnGOhw
 github.com/btcsuite/btclog/v2 v2.0.0-20241017175713-3428138b75c7 h1:3Ct3zN3VCEKVm5nceWBBEKczc+jvTfVyOEG71ob2Yuc=
 github.com/btcsuite/btclog/v2 v2.0.0-20241017175713-3428138b75c7/go.mod h1:XItGUfVOxotJL8kkuk2Hj3EVow5KCugXl3wWfQ6K0AE=
 github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
-github.com/btcsuite/btcwallet/walletdb v1.4.4 h1:BDel6iT/ltYSIYKs0YbjwnEDi7xR3yzABIsQxN2F1L8=
-github.com/btcsuite/btcwallet/walletdb v1.4.4/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs=
+github.com/btcsuite/btcwallet/walletdb v1.5.1 h1:HgMhDNCrtEFPC+8q0ei5DQ5U9Tl4RCspA22DEKXlopI=
+github.com/btcsuite/btcwallet/walletdb v1.5.1/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs=
 github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
 github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
 github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
diff --git a/kvdb/interface.go b/kvdb/interface.go
index 892483024..5fd1ecd16 100644
--- a/kvdb/interface.go
+++ b/kvdb/interface.go
@@ -157,4 +157,8 @@ var (
 	// ErrDatabaseNotOpen is returned when a database instance is accessed
 	// before it is opened or after it is closed.
 	ErrDatabaseNotOpen = walletdb.ErrDbNotOpen
+
+	// ErrDbDoesNotExist is returned when a database instance is opened
+	// but it does not exist.
+	ErrDbDoesNotExist = walletdb.ErrDbDoesNotExist
 )


Test patch:
diff --git a/aliasmgr/aliasmgr_test.go b/aliasmgr/aliasmgr_test.go
index 1844a82ef..b288ade0d 100644
--- a/aliasmgr/aliasmgr_test.go
+++ b/aliasmgr/aliasmgr_test.go
@@ -19,6 +19,7 @@ func TestAliasStorePeerAlias(t *testing.T) {
 	dbPath := filepath.Join(t.TempDir(), "testdb")
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	require.NoError(t, err)
 	defer db.Close()
@@ -52,6 +53,7 @@ func TestAliasStoreRequest(t *testing.T) {
 	dbPath := filepath.Join(t.TempDir(), "testdb")
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	require.NoError(t, err)
 	defer db.Close()
@@ -84,6 +86,7 @@ func TestAliasLifecycle(t *testing.T) {
 	dbPath := filepath.Join(t.TempDir(), "testdb")
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	require.NoError(t, err)
 	defer db.Close()
diff --git a/batch/batch_test.go b/batch/batch_test.go
index fef2c5597..7a73b8f4b 100644
--- a/batch/batch_test.go
+++ b/batch/batch_test.go
@@ -17,7 +17,7 @@ func TestRetry(t *testing.T) {
 
 	dbName := filepath.Join(dbDir, "weks.db")
 	db, err := walletdb.Create(
-		"bdb", dbName, true, kvdb.DefaultDBTimeout,
+		"bdb", dbName, true, kvdb.DefaultDBTimeout, false,
 	)
 	if err != nil {
 		t.Fatalf("unable to create walletdb: %v", err)
diff --git a/channeldb/forwarding_package_test.go b/channeldb/forwarding_package_test.go
index c113d13d5..b11764bee 100644
--- a/channeldb/forwarding_package_test.go
+++ b/channeldb/forwarding_package_test.go
@@ -859,7 +859,7 @@ func makeFwdPkgDB(t *testing.T, path string) kvdb.Backend { // nolint:unparam
 	}
 
 	bdb, err := kvdb.Create(
-		kvdb.BoltBackendName, path, true, kvdb.DefaultDBTimeout,
+		kvdb.BoltBackendName, path, true, kvdb.DefaultDBTimeout, false,
 	)
 	require.NoError(t, err, "unable to open boltdb")
 
diff --git a/channeldb/migtest/migtest.go b/channeldb/migtest/migtest.go
index a3884a0d6..66024c317 100644
--- a/channeldb/migtest/migtest.go
+++ b/channeldb/migtest/migtest.go
@@ -25,6 +25,7 @@ func MakeDB(t testing.TB) (kvdb.Backend, error) {
 
 	db, err := kvdb.Open(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	if err != nil {
 		return nil, err
diff --git a/contractcourt/briefcase_test.go b/contractcourt/briefcase_test.go
index aa2e711ef..3dfc155e4 100644
--- a/contractcourt/briefcase_test.go
+++ b/contractcourt/briefcase_test.go
@@ -149,7 +149,7 @@ var (
 func makeTestDB(t *testing.T) (kvdb.Backend, error) {
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, t.TempDir()+"/test.db", true,
-		kvdb.DefaultDBTimeout,
+		kvdb.DefaultDBTimeout, false,
 	)
 	if err != nil {
 		return nil, err
diff --git a/contractcourt/channel_arbitrator_test.go b/contractcourt/channel_arbitrator_test.go
index 827e10b5c..67a9a42e8 100644
--- a/contractcourt/channel_arbitrator_test.go
+++ b/contractcourt/channel_arbitrator_test.go
@@ -475,7 +475,7 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
 		dbPath := filepath.Join(t.TempDir(), "testdb")
 		db, err := kvdb.Create(
 			kvdb.BoltBackendName, dbPath, true,
-			kvdb.DefaultDBTimeout,
+			kvdb.DefaultDBTimeout, false,
 		)
 		if err != nil {
 			return nil, err
diff --git a/htlcswitch/resolution_store_test.go b/htlcswitch/resolution_store_test.go
index 122c699a1..7562b6897 100644
--- a/htlcswitch/resolution_store_test.go
+++ b/htlcswitch/resolution_store_test.go
@@ -41,6 +41,7 @@ func TestInsertAndDelete(t *testing.T) {
 	dbPath := filepath.Join(t.TempDir(), "testdb")
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	require.NoError(t, err)
 	t.Cleanup(func() {
diff --git a/lntest/unittest/backend.go b/lntest/unittest/backend.go
index 2bca3f96e..0c93fdb15 100644
--- a/lntest/unittest/backend.go
+++ b/lntest/unittest/backend.go
@@ -324,7 +324,8 @@ func NewNeutrinoBackend(t *testing.T, netParams *chaincfg.Params,
 
 	dbName := filepath.Join(spvDir, "neutrino.db")
 	spvDatabase, err := walletdb.Create(
-		"bdb", dbName, true, kvdb.DefaultDBTimeout,
+		kvdb.BoltBackendName, dbName, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	if err != nil {
 		t.Fatalf("unable to create walletdb: %v", err)
diff --git a/lnwallet/test/test_interface.go b/lnwallet/test/test_interface.go
index 52ad1dded..8dce4892d 100644
--- a/lnwallet/test/test_interface.go
+++ b/lnwallet/test/test_interface.go
@@ -3294,8 +3294,9 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
 			// Start Alice - open a database, start a neutrino
 			// instance, and initialize a btcwallet driver for it.
 			aliceDB, err := walletdb.Create(
-				"bdb", tempTestDirAlice+"/neutrino.db", true,
-				kvdb.DefaultDBTimeout,
+				kvdb.BoltBackendName,
+				filepath.Join(tempTestDirAlice, "neutrino.db"),
+				true, kvdb.DefaultDBTimeout, false,
 			)
 			if err != nil {
 				t.Fatalf("unable to create DB: %v", err)
@@ -3323,8 +3324,9 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
 			// Start Bob - open a database, start a neutrino
 			// instance, and initialize a btcwallet driver for it.
 			bobDB, err := walletdb.Create(
-				"bdb", tempTestDirBob+"/neutrino.db", true,
-				kvdb.DefaultDBTimeout,
+				kvdb.BoltBackendName,
+				filepath.Join(tempTestDirBob, "neutrino.db"),
+				true, kvdb.DefaultDBTimeout, false,
 			)
 			if err != nil {
 				t.Fatalf("unable to create DB: %v", err)
diff --git a/macaroons/service_test.go b/macaroons/service_test.go
index aad8af8db..b7694ab3e 100644
--- a/macaroons/service_test.go
+++ b/macaroons/service_test.go
@@ -35,7 +35,7 @@ var (
 func setupTestRootKeyStorage(t *testing.T) kvdb.Backend {
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, path.Join(t.TempDir(), "macaroons.db"), true,
-		kvdb.DefaultDBTimeout,
+		kvdb.DefaultDBTimeout, false,
 	)
 	require.NoError(t, err, "Error opening store DB")
 	t.Cleanup(func() {
diff --git a/macaroons/store_test.go b/macaroons/store_test.go
index ace1e764a..37dce7110 100644
--- a/macaroons/store_test.go
+++ b/macaroons/store_test.go
@@ -37,7 +37,7 @@ func newTestStore(t *testing.T) (string, *macaroons.RootKeyStorage) {
 func openTestStore(t *testing.T, tempDir string) *macaroons.RootKeyStorage {
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, path.Join(tempDir, "weks.db"), true,
-		kvdb.DefaultDBTimeout,
+		kvdb.DefaultDBTimeout, false,
 	)
 	require.NoError(t, err)
 
diff --git a/routing/chainview/interface_test.go b/routing/chainview/interface_test.go
index b8726a875..ecd8bd597 100644
--- a/routing/chainview/interface_test.go
+++ b/routing/chainview/interface_test.go
@@ -757,7 +757,8 @@ var interfaceImpls = []struct {
 
 			dbName := filepath.Join(spvDir, "neutrino.db")
 			spvDatabase, err := walletdb.Create(
-				"bdb", dbName, true, kvdb.DefaultDBTimeout,
+				kvdb.BoltBackendName, dbName, true,
+				kvdb.DefaultDBTimeout, false,
 			)
 			if err != nil {
 				return nil, err
diff --git a/routing/integrated_routing_context_test.go b/routing/integrated_routing_context_test.go
index 7270b6f6d..e89df8aee 100644
--- a/routing/integrated_routing_context_test.go
+++ b/routing/integrated_routing_context_test.go
@@ -152,6 +152,7 @@ func (c *integratedRoutingContext) testPayment(maxParts uint32,
 
 	db, err := kvdb.Open(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	if err != nil {
 		c.t.Fatal(err)
diff --git a/routing/missioncontrol_store_test.go b/routing/missioncontrol_store_test.go
index f1788a96a..b83a526e9 100644
--- a/routing/missioncontrol_store_test.go
+++ b/routing/missioncontrol_store_test.go
@@ -54,6 +54,7 @@ func newMCStoreTestHarness(t testing.TB, maxRecords int,
 
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	require.NoError(t, err)
 	t.Cleanup(func() {
diff --git a/routing/missioncontrol_test.go b/routing/missioncontrol_test.go
index dad033ac4..aa13a064a 100644
--- a/routing/missioncontrol_test.go
+++ b/routing/missioncontrol_test.go
@@ -72,6 +72,7 @@ func createMcTestContext(t *testing.T) *mcTestContext {
 
 	ctx.db, err = kvdb.Open(
 		kvdb.BoltBackendName, ctx.dbPath, true, kvdb.DefaultDBTimeout,
+		false,
 	)
 	if err != nil {
 		t.Fatal(err)
diff --git a/walletunlocker/service_test.go b/walletunlocker/service_test.go
index 13ddb61e5..62dfc28d7 100644
--- a/walletunlocker/service_test.go
+++ b/walletunlocker/service_test.go
@@ -114,7 +114,7 @@ func openOrCreateTestMacStore(tempDir string, pw *[]byte,
 	}
 	db, err := kvdb.Create(
 		kvdb.BoltBackendName, path.Join(netDir, "macaroons.db"),
-		true, kvdb.DefaultDBTimeout,
+		true, kvdb.DefaultDBTimeout, false,
 	)
 	if err != nil {
 		return nil, err