randomized mock db path (#6541)

This commit is contained in:
Alex Sharov 2023-01-10 13:52:05 +07:00 committed by GitHub
parent d8f6ca8485
commit 919fc390be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -218,7 +218,12 @@ func MockWithEverything(t *testing.T, gspec *core.Genesis, key *ecdsa.PrivateKey
cfg.DeprecatedTxPool.Disable = !withTxPool
cfg.DeprecatedTxPool.StartOnInit = true
db := memdb.New()
var db kv.RwDB
if t != nil {
db = memdb.NewTestDB(t)
} else {
db = memdb.New()
}
ctx, ctxCancel := context.WithCancel(context.Background())
_ = db.Update(ctx, func(tx kv.RwTx) error {
_, _ = kvcfg.HistoryV3.WriteOnce(tx, cfg.HistoryV3)