channeldb: add NoMigration mode

In case the channeldb package is used as a library in external tools, it
can be useful to allow read-only access to a DB. This allows such a
tool to access a DB even if not all migrations were executed, which can
be useful for recovery purposes.
To make it possible to even start the DB with a read-only backend, we
need to disable the automatic migration step.
This commit is contained in:
Oliver Gugger committed 2021-12-13 12:31:49 +01:00
1 parent a8f75e0221
commit b147d589c1
5 files changed
+33 -13

No files matched your search

+1 -1
View File
@@ -175,7 +175,7 @@ func makeTestGraph(useCache bool) (*channeldb.ChannelGraph, kvdb.Backend,
graph, err := channeldb.NewChannelGraph(
backend, opts.RejectCacheSize, opts.ChannelCacheSize,
opts.BatchCommitInterval, opts.PreAllocCacheNumNodes,
useCache,
useCache, false,
)
if err != nil {
cleanUp()