checkChangeSet to work with MDBX, load senders for better performance (#2024)

* CheckchangeSets switch to MDBX

* Load senders

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
This commit is contained in:
ledgerwatch 2021-05-27 08:37:23 +01:00 committed by GitHub
parent 5a0afc0a72
commit d5c2e5fd9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,11 @@ func CheckChangeSets(genesis *core.Genesis, blockNum uint64, chaindata string, h
interruptCh <- true
}()
chainDb := ethdb.MustOpen(chaindata)
kv, err := ethdb.NewMDBX().Path(chaindata).Open()
if err != nil {
return err
}
chainDb := ethdb.NewObjectDatabase(kv)
defer chainDb.Close()
historyDb := chainDb
if chaindata != historyfile {
@ -113,7 +117,11 @@ func CheckChangeSets(genesis *core.Genesis, blockNum uint64, chaindata string, h
if err != nil {
return err
}
block := rawdb.ReadBlock(rwtx, blockHash, blockNum)
var block *types.Block
block, _, err = rawdb.ReadBlockWithSenders(rwtx, blockHash, blockNum)
if err != nil {
return err
}
if block == nil {
break
}