From 9d56c7175ed6ae2e97a161d950764efc60123963 Mon Sep 17 00:00:00 2001 From: Jimmy Hu Date: Thu, 7 Mar 2019 15:49:23 +0800 Subject: core: Only accept block from nodeset (#467) --- core/consensus.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/consensus.go b/core/consensus.go index 0f4daa7..871e855 100644 --- a/core/consensus.go +++ b/core/consensus.go @@ -1075,6 +1075,14 @@ func (con *Consensus) ProcessBlockRandomnessResult( // preProcessBlock performs Byzantine Agreement on the block. func (con *Consensus) preProcessBlock(b *types.Block) (err error) { + var exist bool + exist, err = con.nodeSetCache.Exists(b.Position.Round, b.ProposerID) + if err != nil { + return + } + if !exist { + return ErrProposerNotInNodeSet + } err = con.baMgr.processBlock(b) if err == nil && con.debugApp != nil { con.debugApp.BlockReceived(b.Hash) -- cgit