forked from TrueCloudLab/neoneo-go
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 {
|
func (s *service) verifyBlock(b block.Block) bool {
|
||||||
coreb := &b.(*neoBlock).Block
|
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())
|
maxBlockSize := int(s.Chain.GetMaxBlockSize())
|
||||||
size := io.GetVarSize(coreb)
|
size := io.GetVarSize(coreb)
|
||||||
if size > maxBlockSize {
|
if size > maxBlockSize {
|
||||||
|
@ -379,6 +383,10 @@ func (s *service) verifyBlock(b block.Block) bool {
|
||||||
zap.Error(err))
|
zap.Error(err))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if s.Chain.BlockHeight() >= coreb.Index {
|
||||||
|
s.log.Warn("proposed block has already outdated")
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maxBlockSysFee := s.Chain.GetMaxBlockSystemFee()
|
maxBlockSysFee := s.Chain.GetMaxBlockSystemFee()
|
||||||
|
|
Loading…
Reference in a new issue