diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index a4bd9024f..31be69473 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -588,7 +588,7 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { go func() { blk.SetCurrentCommitSig(bareMinimumCommit) - if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, true); err != nil { + if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, !consensus.FBFTLog.IsBlockVerified(blk)); err != nil { consensus.getLogger().Error().Err(err).Msg("[preCommitAndPropose] Failed to add block to chain") return } @@ -690,7 +690,7 @@ func (consensus *Consensus) tryCatchup() error { func (consensus *Consensus) commitBlock(blk *types.Block, committedMsg *FBFTMessage) error { if consensus.Blockchain.CurrentBlock().NumberU64() < blk.NumberU64() { - if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, true); err != nil { + if _, err := consensus.Blockchain.InsertChain([]*types.Block{blk}, !consensus.FBFTLog.IsBlockVerified(blk)); err != nil { consensus.getLogger().Error().Err(err).Msg("[commitBlock] Failed to add block to chain") return err } diff --git a/consensus/leader.go b/consensus/leader.go index 3e8646131..abf07adcf 100644 --- a/consensus/leader.go +++ b/consensus/leader.go @@ -296,6 +296,7 @@ func (consensus *Consensus) onCommit(recvMsg *FBFTMessage) { if !quorumWasMet && quorumIsMet { logger.Info().Msg("[OnCommit] 2/3 Enough commits received") + consensus.FBFTLog.MarkBlockVerified(blockObj) if !blockObj.IsLastBlockInEpoch() { // only do early commit if it's not epoch block to avoid problems diff --git a/node/node_explorer.go b/node/node_explorer.go index d90556a11..a10c0cf9d 100644 --- a/node/node_explorer.go +++ b/node/node_explorer.go @@ -122,7 +122,7 @@ func (node *Node) explorerMessageHandler(ctx context.Context, msg *msg_pb.Messag // AddNewBlockForExplorer add new block for explorer. func (node *Node) AddNewBlockForExplorer(block *types.Block) { utils.Logger().Info().Uint64("blockHeight", block.NumberU64()).Msg("[Explorer] Adding new block for explorer node") - if _, err := node.Blockchain().InsertChain([]*types.Block{block}, true); err == nil { + if _, err := node.Blockchain().InsertChain([]*types.Block{block}, false); err == nil { if block.IsLastBlockInEpoch() { node.Consensus.UpdateConsensusInformation() }