|
|
@ -88,11 +88,12 @@ func (node *Node) AddNewBlockForExplorer() { |
|
|
|
// Search for the next block in PbftLog and commit the block into blockchain for explorer node.
|
|
|
|
// Search for the next block in PbftLog and commit the block into blockchain for explorer node.
|
|
|
|
for { |
|
|
|
for { |
|
|
|
blocks := node.Consensus.PbftLog.GetBlocksByNumber(node.Blockchain().CurrentBlock().NumberU64() + 1) |
|
|
|
blocks := node.Consensus.PbftLog.GetBlocksByNumber(node.Blockchain().CurrentBlock().NumberU64() + 1) |
|
|
|
if len(blocks) > 1 { |
|
|
|
if len(blocks) == 0 { |
|
|
|
utils.GetLogInstance().Error("We should have not received more than one block with the same block height.") |
|
|
|
|
|
|
|
} else if len(blocks) == 0 { |
|
|
|
|
|
|
|
break |
|
|
|
break |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if len(blocks) > 1 { |
|
|
|
|
|
|
|
utils.GetLogInstance().Error("We should have not received more than one block with the same block height.") |
|
|
|
|
|
|
|
} |
|
|
|
utils.GetLogInstance().Info("Adding new block for explorer node", "blockHeight", blocks[0].NumberU64()) |
|
|
|
utils.GetLogInstance().Info("Adding new block for explorer node", "blockHeight", blocks[0].NumberU64()) |
|
|
|
node.AddNewBlock(blocks[0]) |
|
|
|
node.AddNewBlock(blocks[0]) |
|
|
|
// Clean up the blocks to avoid OOM.
|
|
|
|
// Clean up the blocks to avoid OOM.
|
|
|
|