core/state/snapshot: clarify comment about snapshot repair (#23305)
Co-authored-by: Tyler Chambers <me@tylerchambers.net> Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
57d9e0ac75
commit
66948316f7
@ -169,11 +169,17 @@ type Tree struct {
|
|||||||
// store (with a number of memory layers from a journal), ensuring that the head
|
// store (with a number of memory layers from a journal), ensuring that the head
|
||||||
// of the snapshot matches the expected one.
|
// of the snapshot matches the expected one.
|
||||||
//
|
//
|
||||||
// If the snapshot is missing or the disk layer is broken, the entire is deleted
|
// If the snapshot is missing or the disk layer is broken, the snapshot will be
|
||||||
// and will be reconstructed from scratch based on the tries in the key-value
|
// reconstructed using both the existing data and the state trie.
|
||||||
// store, on a background thread. If the memory layers from the journal is not
|
// The repair happens on a background thread.
|
||||||
// continuous with disk layer or the journal is missing, all diffs will be discarded
|
//
|
||||||
// iff it's in "recovery" mode, otherwise rebuild is mandatory.
|
// If the memory layers in the journal do not match the disk layer (e.g. there is
|
||||||
|
// a gap) or the journal is missing, there are two repair cases:
|
||||||
|
//
|
||||||
|
// - if the 'recovery' parameter is true, all memory diff-layers will be discarded.
|
||||||
|
// This case happens when the snapshot is 'ahead' of the state trie.
|
||||||
|
// - otherwise, the entire snapshot is considered invalid and will be recreated on
|
||||||
|
// a background thread.
|
||||||
func New(diskdb ethdb.KeyValueStore, triedb *trie.Database, cache int, root common.Hash, async bool, rebuild bool, recovery bool) (*Tree, error) {
|
func New(diskdb ethdb.KeyValueStore, triedb *trie.Database, cache int, root common.Hash, async bool, rebuild bool, recovery bool) (*Tree, error) {
|
||||||
// Create a new, empty snapshot tree
|
// Create a new, empty snapshot tree
|
||||||
snap := &Tree{
|
snap := &Tree{
|
||||||
|
Loading…
Reference in New Issue
Block a user