mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/downloader: disable trie database whenever state sync is launched
This commit is contained in:
parent
423a1e99f8
commit
c57c3f2573
1 changed files with 8 additions and 1 deletions
|
|
@ -398,7 +398,14 @@ func (d *Downloader) synchronise(id string, hash common.Hash, td, ttd *big.Int,
|
||||||
log.Info("Block synchronisation started")
|
log.Info("Block synchronisation started")
|
||||||
}
|
}
|
||||||
if mode == SnapSync {
|
if mode == SnapSync {
|
||||||
// Snap sync uses the snapshot namespace to store potentially flakey data until
|
// Snap sync will directly modify the persistent state, making the entire
|
||||||
|
// trie database unusable until the state is fully synced. To prevent any
|
||||||
|
// subsequent state reads, explicitly disable the trie database and state
|
||||||
|
// syncer is responsible to address and correct any state missing.
|
||||||
|
if d.blockchain.TrieDB().Scheme() == rawdb.PathScheme {
|
||||||
|
d.blockchain.TrieDB().Reset(types.EmptyRootHash)
|
||||||
|
}
|
||||||
|
// 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-
|
||||||
// time to prevent access.
|
// time to prevent access.
|
||||||
if snapshots := d.blockchain.Snapshots(); snapshots != nil { // Only nil in tests
|
if snapshots := d.blockchain.Snapshots(); snapshots != nil { // Only nil in tests
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue