consensus: check for chain's height in verifyBlock

We may already be behind and this check could be irrelevant.
This commit is contained in:
Roman Khimov 2020-08-19 19:38:50 +03:00
parent 55b2cbb74d
commit d9b8704b48

View file

@ -349,6 +349,10 @@ func (s *service) getTx(h util.Uint256) block.Transaction {
func (s *service) verifyBlock(b block.Block) bool {
coreb := &b.(*neoBlock).Block
if s.Chain.BlockHeight() >= coreb.Index {
s.log.Warn("proposed block has already outdated")
return false
}
maxBlockSize := int(s.Chain.GetMaxBlockSize())
size := io.GetVarSize(coreb)
if size > maxBlockSize {
@ -379,6 +383,10 @@ func (s *service) verifyBlock(b block.Block) bool {
zap.Error(err))
return false
}
if s.Chain.BlockHeight() >= coreb.Index {
s.log.Warn("proposed block has already outdated")
return false
}
}
maxBlockSysFee := s.Chain.GetMaxBlockSystemFee()