diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 118028676..8f029846f 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -1844,9 +1844,9 @@ func (bc *Blockchain) updateStateHeight(newHeight uint32) error { h, err := bc.dao.GetCurrentStateRootHeight() if err != nil { return errors.WithMessage(err, "can't get current state root height") - } else if newHeight == h+1 { + } else if (h < bc.config.StateRootEnableIndex && newHeight == bc.config.StateRootEnableIndex) || newHeight == h+1 { updateStateHeightMetric(newHeight) - return bc.dao.PutCurrentStateRootHeight(h + 1) + return bc.dao.PutCurrentStateRootHeight(newHeight) } return nil } diff --git a/pkg/network/server.go b/pkg/network/server.go index 690e92b31..aadc7d6d0 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -630,7 +630,7 @@ func (s *Server) handleRootsCmd(p Peer, rs *payload.StateRoots) error { } h := s.chain.StateHeight() if h < s.chain.GetConfig().StateRootEnableIndex { - h = s.chain.GetConfig().StateRootEnableIndex + h = s.chain.GetConfig().StateRootEnableIndex - 1 } for i := range rs.Roots { if rs.Roots[i].Index <= h {