bor: ensure db exists (#3449)

This commit is contained in:
Alex Sharov 2022-02-09 09:28:06 +07:00 committed by GitHub
parent e82e19c4a4
commit e5081c78b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -260,6 +260,14 @@ func RemoteServices(ctx context.Context, cfg Flags, logger log.Logger, rootCance
// bor (consensus) specific db
var borKv kv.RoDB
borDbPath := path.Join(cfg.Datadir, "bor")
{
// ensure db exist
tmpDb, err := kv2.NewMDBX(logger).Path(borDbPath).Open()
if err != nil {
return nil, nil, nil, nil, nil, nil, nil, nil, err
}
tmpDb.Close()
}
log.Trace("Creating consensus db", "path", borDbPath)
borKv, err = kv2.NewMDBX(logger).Path(borDbPath).Readonly().Open()
if err != nil {