From 25307834abf16b2e2587dd3693119ffc2f983543 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 13 Aug 2020 19:34:52 +0300 Subject: [PATCH] consensus: don't generate stateroot before StateRootEnableIndex --- pkg/consensus/consensus.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 0c2dcbaab..7fcc1d35e 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -260,7 +260,7 @@ func (s *service) getStateRootSig() []byte { } 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 // relay stateroot here. stateRoot, err := s.Chain.GetStateRoot(s.dbft.Context.BlockIndex - 1)