Fix condition for explorer node to update consensus info (#2060)

pull/2065/head
Rongjian Lan 5 years ago committed by GitHub
parent cf7d737c88
commit 7bbd162425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      node/node_explorer.go

@ -13,7 +13,6 @@ import (
"github.com/harmony-one/harmony/consensus"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/internal/utils"
"github.com/harmony-one/harmony/shard"
)
var once sync.Once
@ -104,7 +103,7 @@ func (node *Node) ExplorerMessageHandler(payload []byte) {
func (node *Node) AddNewBlockForExplorer(block *types.Block) {
utils.Logger().Debug().Uint64("blockHeight", block.NumberU64()).Msg("[Explorer] Adding new block for explorer node")
if _, err := node.Blockchain().InsertChain([]*types.Block{block}, true); err == nil {
if shard.Schedule.IsLastBlock(block.Number().Uint64()) {
if len(block.Header().ShardState()) > 0 {
node.Consensus.UpdateConsensusInformation()
}
// Clean up the blocks to avoid OOM.

Loading…
Cancel
Save