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
2021-12-13 10:53:58 +01:00
parent a8f75e0221
commit b147d589c1
5 changed files with 33 additions and 13 deletions

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()