channeldb: move .SyncVersions() into .Open(), minor migration cleanups

This commit unexports the SyncVerions PR, in favor of making it private
and moving it into the .Open() method. With this change, callers no
longer need worry about ensuring the database version is up to sync
before usage, as it will happen automatically once the database is
opened.

This commit also unexports some additional variables within the package
that don’t need be consumed by the public, and exports the
DbVersionNumber attribute on the meta struct. Finally some minor
formatting fixes have neen carried out to ensure the new code more
closely matches the style of the rest of the codebase.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-11-22 16:00:02 -06:00
1 parent 25167361d2
commit b70d1f8cfe
4 files changed
+71 -65

No files matched your search

-6
View File
@@ -67,12 +67,6 @@ func lndMain() error {
}
defer chanDB.Close()
// Synchronize the version of database and apply migration if needed.
if err := chanDB.SyncVersions(channeldb.DBVersions); err != nil {
fmt.Println("unable to sync versions: ", err)
return err
}
// Next load btcd's TLS cert for the RPC connection. If a raw cert was
// specified in the config, then we'll se that directly. Otherwise, we
// attempt to read the cert from the path specified in the config.