forked from TrueCloudLab/neoneo-go
core: fix race in stateroot initialization error logging
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
9cd5c88077
commit
7ca4ce0f79
1 changed files with 3 additions and 2 deletions
|
@ -203,8 +203,9 @@ func (s *Module) Init(height uint32) error {
|
||||||
// outdated MPT data before state sync process can be started.
|
// outdated MPT data before state sync process can be started.
|
||||||
// Note: this method is aimed to be called for genesis block only, an error is returned otherwise.
|
// Note: this method is aimed to be called for genesis block only, an error is returned otherwise.
|
||||||
func (s *Module) CleanStorage() error {
|
func (s *Module) CleanStorage() error {
|
||||||
if s.localHeight.Load() != 0 {
|
lH := s.localHeight.Load()
|
||||||
return fmt.Errorf("can't clean MPT data for non-genesis block: expected local stateroot height 0, got %d", s.localHeight.Load())
|
if lH != 0 {
|
||||||
|
return fmt.Errorf("can't clean MPT data for non-genesis block: expected local stateroot height 0, got %d", lH)
|
||||||
}
|
}
|
||||||
b := storage.NewMemCachedStore(s.Store)
|
b := storage.NewMemCachedStore(s.Store)
|
||||||
s.Store.Seek(storage.SeekRange{Prefix: []byte{byte(storage.DataMPT)}}, func(k, _ []byte) bool {
|
s.Store.Seek(storage.SeekRange{Prefix: []byte{byte(storage.DataMPT)}}, func(k, _ []byte) bool {
|
||||||
|
|
Loading…
Reference in a new issue