Merge pull request #22294 from holiman/pruner_compact_fix
core/state/pruner: fix compaction range error
This commit is contained in:
commit
2fdba3aacb
|
@ -186,16 +186,15 @@ func prune(maindb ethdb.Database, stateBloom *stateBloom, middleStateRoots map[c
|
||||||
// Note for small pruning, the compaction is skipped.
|
// Note for small pruning, the compaction is skipped.
|
||||||
if count >= rangeCompactionThreshold {
|
if count >= rangeCompactionThreshold {
|
||||||
cstart := time.Now()
|
cstart := time.Now()
|
||||||
|
for b := 0x00; b <= 0xf0; b += 0x10 {
|
||||||
for b := byte(0); b < byte(16); b++ {
|
|
||||||
var (
|
var (
|
||||||
start = []byte{b << 4}
|
start = []byte{byte(b)}
|
||||||
end = []byte{(b+1)<<4 - 1}
|
end = []byte{byte(b + 0x10)}
|
||||||
)
|
)
|
||||||
log.Info("Compacting database", "range", fmt.Sprintf("%#x-%#x", start, end), "elapsed", common.PrettyDuration(time.Since(cstart)))
|
if b == 0xf0 {
|
||||||
if b == 15 {
|
|
||||||
end = nil
|
end = nil
|
||||||
}
|
}
|
||||||
|
log.Info("Compacting database", "range", fmt.Sprintf("%#x-%#x", start, end), "elapsed", common.PrettyDuration(time.Since(cstart)))
|
||||||
if err := maindb.Compact(start, end); err != nil {
|
if err := maindb.Compact(start, end); err != nil {
|
||||||
log.Error("Database compaction failed", "error", err)
|
log.Error("Database compaction failed", "error", err)
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue