Skip to content

Commit 79addac

Browse files
authored
core/rawdb: better log messages for ancient failure (#21327)
1 parent 7d5267e commit 79addac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/rawdb/database.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ func NewDatabaseWithFreezer(db ethdb.KeyValueStore, freezer string, namespace st
137137
// If the freezer already contains something, ensure that the genesis blocks
138138
// match, otherwise we might mix up freezers across chains and destroy both
139139
// the freezer and the key-value store.
140-
if frgenesis, _ := frdb.Ancient(freezerHashTable, 0); !bytes.Equal(kvgenesis, frgenesis) {
140+
frgenesis, err := frdb.Ancient(freezerHashTable, 0)
141+
if err != nil {
142+
return nil, fmt.Errorf("failed to retrieve genesis from ancient %v", err)
143+
} else if !bytes.Equal(kvgenesis, frgenesis) {
141144
return nil, fmt.Errorf("genesis mismatch: %#x (leveldb) != %#x (ancients)", kvgenesis, frgenesis)
142145
}
143146
// Key-value store and freezer belong to the same network. Ensure that they

0 commit comments

Comments
 (0)