|
|
@ -156,7 +156,7 @@ func (consensus *Consensus) finalCommit() { |
|
|
|
// included in the next block and sent in next prepared message.
|
|
|
|
// included in the next block and sent in next prepared message.
|
|
|
|
|
|
|
|
|
|
|
|
sendImmediately := false |
|
|
|
sendImmediately := false |
|
|
|
if !consensus.IsLeader() { |
|
|
|
if !consensus.IsLeader() || block.IsLastBlockInEpoch() { |
|
|
|
sendImmediately = true |
|
|
|
sendImmediately = true |
|
|
|
} |
|
|
|
} |
|
|
|
if err := consensus.msgSender.SendWithRetry( |
|
|
|
if err := consensus.msgSender.SendWithRetry( |
|
|
@ -522,18 +522,20 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { |
|
|
|
// If I am still the leader
|
|
|
|
// If I am still the leader
|
|
|
|
//if consensus.IsLeader() {
|
|
|
|
//if consensus.IsLeader() {
|
|
|
|
// if leader success finalize the block, send committed message to validators
|
|
|
|
// if leader success finalize the block, send committed message to validators
|
|
|
|
if err := consensus.msgSender.SendWithRetry( |
|
|
|
if !blk.IsLastBlockInEpoch() { |
|
|
|
blk.NumberU64(), |
|
|
|
if err := consensus.msgSender.SendWithRetry( |
|
|
|
msg_pb.MessageType_COMMITTED, []nodeconfig.GroupID{ |
|
|
|
blk.NumberU64(), |
|
|
|
nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID)), |
|
|
|
msg_pb.MessageType_COMMITTED, []nodeconfig.GroupID{ |
|
|
|
}, |
|
|
|
nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID)), |
|
|
|
p2p.ConstructMessage(msgToSend), true); err != nil { |
|
|
|
}, |
|
|
|
consensus.getLogger().Warn().Err(err).Msg("[preCommitAndPropose] Cannot send committed message") |
|
|
|
p2p.ConstructMessage(msgToSend), true); err != nil { |
|
|
|
} else { |
|
|
|
consensus.getLogger().Warn().Err(err).Msg("[preCommitAndPropose] Cannot send committed message") |
|
|
|
consensus.getLogger().Info(). |
|
|
|
} else { |
|
|
|
Str("blockHash", blk.Hash().Hex()). |
|
|
|
consensus.getLogger().Info(). |
|
|
|
Uint64("blockNum", consensus.blockNum). |
|
|
|
Str("blockHash", blk.Hash().Hex()). |
|
|
|
Msg("[preCommitAndPropose] Sent Committed Message") |
|
|
|
Uint64("blockNum", consensus.blockNum). |
|
|
|
|
|
|
|
Msg("[preCommitAndPropose] Sent Committed Message") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Send signal to Node to propose the new block for consensus
|
|
|
|
// Send signal to Node to propose the new block for consensus
|
|
|
|