consensus: don't generate stateroot before StateRootEnableIndex

This commit is contained in:
Roman Khimov 2020-08-13 19:34:52 +03:00
parent ee61120e13
commit 25307834ab

View file

@ -260,7 +260,7 @@ func (s *service) getStateRootSig() []byte {
} }
func (s *service) newCommit() payload.Commit { func (s *service) newCommit() payload.Commit {
if s.stateRootEnabled() { if s.stateRootEnabled() && s.dbft.Context.BlockIndex > s.Chain.GetConfig().StateRootEnableIndex {
// This is being called when we're ready to commit, so we can safely // This is being called when we're ready to commit, so we can safely
// relay stateroot here. // relay stateroot here.
stateRoot, err := s.Chain.GetStateRoot(s.dbft.Context.BlockIndex - 1) stateRoot, err := s.Chain.GetStateRoot(s.dbft.Context.BlockIndex - 1)