diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-07 15:49:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 15:49:23 +0800 |
commit | 9d56c7175ed6ae2e97a161d950764efc60123963 (patch) | |
tree | e6083a2569ce0bbd4c15a28ddc79578b8cbe281c | |
parent | 69c8d0dba506f640af4c5539fa424957cdd35db3 (diff) | |
download | dexon-consensus-9d56c7175ed6ae2e97a161d950764efc60123963.tar.gz dexon-consensus-9d56c7175ed6ae2e97a161d950764efc60123963.tar.zst dexon-consensus-9d56c7175ed6ae2e97a161d950764efc60123963.zip |
core: Only accept block from nodeset (#467)
-rw-r--r-- | core/consensus.go | 8 |
1 files changed, 8 insertions, 0 deletions
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) |