@@ -42,13 +42,6 @@ import (
4242 "github.com/ava-labs/libevm/triedb"
4343)
4444
45- var (
46- errSnapshotRootEmpty = errors .New ("missing or corrupted snapshot, no snapshot root" )
47- errSnapshotBlockHashEmpty = errors .New ("missing or corrupted snapshot, no snapshot block hash" )
48- errSnapshotRootMismatch = errors .New ("snapshot root mismatch" )
49- errSnapshotGeneratorMissing = errors .New ("missing snapshot generator" )
50- )
51-
5245// journalGenerator is a disk layer entry containing the generator progress marker.
5346type journalGenerator struct {
5447 // Indicator that whether the database was in progress of being wiped.
@@ -69,24 +62,22 @@ func loadSnapshot(diskdb ethdb.KeyValueStore, triedb *triedb.Database, cache int
6962 // Retrieve the block hash of the snapshot, failing if no snapshot is present.
7063 baseBlockHash , err := customrawdb .ReadSnapshotBlockHash (diskdb )
7164 if err != nil {
72- return nil , false , errSnapshotBlockHashEmpty
65+ return nil , false , errors . New ( "missing or corrupted snapshot, no snapshot block hash" )
7366 }
74-
75- // Retrieve and validate the snapshot root.
7667 baseRoot := rawdb .ReadSnapshotRoot (diskdb )
7768 switch {
7869 case baseRoot == (common.Hash {}):
79- return nil , false , errSnapshotRootEmpty
70+ return nil , false , errors . New ( "missing or corrupted snapshot, no snapshot root" )
8071 case baseRoot != root :
81- return nil , false , fmt .Errorf ("%w: stored %#x, expected %#x" , errSnapshotRootMismatch , baseRoot , root )
72+ return nil , false , fmt .Errorf ("root stored on disk ( %#x) does not match last accepted ( %#x)" , baseRoot , root )
8273 }
8374
8475 // Retrieve the disk layer generator. It must exist, no matter the
8576 // snapshot is fully generated or not. Otherwise the entire disk
8677 // layer is invalid.
8778 generatorBlob := rawdb .ReadSnapshotGenerator (diskdb )
8879 if len (generatorBlob ) == 0 {
89- return nil , false , errSnapshotGeneratorMissing
80+ return nil , false , errors . New ( "missing snapshot generator" )
9081 }
9182 var generator journalGenerator
9283 if err := rlp .DecodeBytes (generatorBlob , & generator ); err != nil {
0 commit comments