diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-03-10 11:58:38 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@byzantine-lab.io> | 2019-06-12 17:27:22 +0800 |
commit | 763f3e1d551ebf641f747faa478326d6daa7c620 (patch) | |
tree | c88b6c11f41c3a0a6dec49e57be8266a38beec64 /vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go | |
parent | 7d984e09de86a71b4dfa3f09321d4ffa11153c5c (diff) | |
download | go-tangerine-763f3e1d551ebf641f747faa478326d6daa7c620.tar.gz go-tangerine-763f3e1d551ebf641f747faa478326d6daa7c620.tar.zst go-tangerine-763f3e1d551ebf641f747faa478326d6daa7c620.zip |
vendor: sync to latest core (#237)
Diffstat (limited to 'vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go')
-rw-r--r-- | vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go index 0f4daa766..050bfe7e5 100644 --- a/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go +++ b/vendor/github.com/dexon-foundation/dexon-consensus/core/consensus.go @@ -127,7 +127,15 @@ func (recv *consensusBAReceiver) ConfirmBlock( return } if block == nil { - panic(fmt.Errorf("empty block should be proposed directly: %s", aID)) + // The empty block's parent is not found locally, thus we can't + // propose it at this moment. + // + // We can only rely on block pulling upon receiving + // types.AgreementResult from the next position. + recv.consensus.logger.Warn( + "An empty block is confirmed without its parent", + "position", aID) + return } } else { var exist bool @@ -1075,6 +1083,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) |