mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-01-05 19:35:48 +00:00
dao: don't treat zero stateroot as valid during MPT init
Because it's not really valid and MPT state should be the same as if it was initialized at height 0. Fixes #1870
This commit is contained in:
parent
d8c8593410
commit
bcc2d1bb8f
1 changed files with 5 additions and 1 deletions
|
@ -531,7 +531,11 @@ func (dao *Simple) InitMPT(height uint32, enableRefCount bool) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dao.MPT = mpt.NewTrie(mpt.NewHashNode(r.Root), enableRefCount, dao.Store)
|
||||
var rootnode mpt.Node
|
||||
if !r.Root.Equals(util.Uint256{}) { // some initial blocks can have root == 0 and it's not a valid root
|
||||
rootnode = mpt.NewHashNode(r.Root)
|
||||
}
|
||||
dao.MPT = mpt.NewTrie(rootnode, enableRefCount, dao.Store)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue