mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
consensus: check for chain's height in verifyBlock
We may already be behind and this check could be irrelevant.
This commit is contained in:
parent
55b2cbb74d
commit
d9b8704b48
1 changed files with 8 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue