mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth, trie: address comments
This commit is contained in:
parent
505ece695a
commit
bcd5792ca4
2 changed files with 8 additions and 3 deletions
|
|
@ -403,7 +403,9 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td, ttd *big.Int,
|
||||||
// subsequent state reads, explicitly disable the trie database and state
|
// subsequent state reads, explicitly disable the trie database and state
|
||||||
// syncer is responsible to address and correct any state missing.
|
// syncer is responsible to address and correct any state missing.
|
||||||
if d.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
|
if d.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
|
||||||
d.blockchain.TrieDB().Deactivate()
|
if err := d.blockchain.TrieDB().Deactivate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Snap sync uses the snapshot namespace to store potentially flaky data until
|
// Snap sync uses the snapshot namespace to store potentially flaky data until
|
||||||
// sync completely heals and finishes. Pause snapshot maintenance in the mean-
|
// sync completely heals and finishes. Pause snapshot maintenance in the mean-
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,9 @@ func New(diskdb ethdb.Database, config *Config) *Database {
|
||||||
}
|
}
|
||||||
// Disable database in case node is still in the initial state sync stage.
|
// Disable database in case node is still in the initial state sync stage.
|
||||||
if rawdb.ReadSnapSyncStatusFlag(diskdb) == rawdb.StateSyncRunning && !db.readOnly {
|
if rawdb.ReadSnapSyncStatusFlag(diskdb) == rawdb.StateSyncRunning && !db.readOnly {
|
||||||
db.Deactivate()
|
if err := db.Deactivate(); err != nil {
|
||||||
|
log.Crit("Failed to disable database", "err", err) // impossible to happen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
log.Warn("Path-based state scheme is an experimental feature")
|
log.Warn("Path-based state scheme is an experimental feature")
|
||||||
return db
|
return db
|
||||||
|
|
@ -252,6 +254,7 @@ func (db *Database) Deactivate() error {
|
||||||
}
|
}
|
||||||
// Prevent duplicated disable operation.
|
// Prevent duplicated disable operation.
|
||||||
if db.waitSync {
|
if db.waitSync {
|
||||||
|
log.Error("Reject duplicated disable operation")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
db.waitSync = true
|
db.waitSync = true
|
||||||
|
|
@ -279,7 +282,7 @@ func (db *Database) Activate(root common.Hash) error {
|
||||||
root = types.TrieRootHash(root)
|
root = types.TrieRootHash(root)
|
||||||
_, stored := rawdb.ReadAccountTrieNode(db.diskdb, nil)
|
_, stored := rawdb.ReadAccountTrieNode(db.diskdb, nil)
|
||||||
if stored != root {
|
if stored != root {
|
||||||
return fmt.Errorf("state is mismatched, stored: %x, target: %x", stored, root)
|
return fmt.Errorf("state root mismatch: stored %x, synced %x", stored, root)
|
||||||
}
|
}
|
||||||
// Drop the stale state journal in persistent database and
|
// Drop the stale state journal in persistent database and
|
||||||
// reset the persistent state id back to zero.
|
// reset the persistent state id back to zero.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue