|
|
@ -60,6 +60,9 @@ func (consensus *Consensus) onAnnounce(msg *msg_pb.Message) { |
|
|
|
func (consensus *Consensus) prepare() { |
|
|
|
func (consensus *Consensus) prepare() { |
|
|
|
groupID := []nodeconfig.GroupID{nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID))} |
|
|
|
groupID := []nodeconfig.GroupID{nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID))} |
|
|
|
for i, key := range consensus.PubKey.PublicKey { |
|
|
|
for i, key := range consensus.PubKey.PublicKey { |
|
|
|
|
|
|
|
if !consensus.IsValidatorInCommittee(key) { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
networkMessage, err := consensus.construct(msg_pb.MessageType_PREPARE, nil, key, consensus.priKey.PrivateKey[i]) |
|
|
|
networkMessage, err := consensus.construct(msg_pb.MessageType_PREPARE, nil, key, consensus.priKey.PrivateKey[i]) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
consensus.getLogger().Err(err). |
|
|
|
consensus.getLogger().Err(err). |
|
|
@ -208,6 +211,10 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { |
|
|
|
nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID)), |
|
|
|
nodeconfig.NewGroupIDByShardID(nodeconfig.ShardID(consensus.ShardID)), |
|
|
|
} |
|
|
|
} |
|
|
|
for i, key := range consensus.PubKey.PublicKey { |
|
|
|
for i, key := range consensus.PubKey.PublicKey { |
|
|
|
|
|
|
|
if !consensus.IsValidatorInCommittee(key) { |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
networkMessage, _ := consensus.construct( |
|
|
|
networkMessage, _ := consensus.construct( |
|
|
|
msg_pb.MessageType_COMMIT, |
|
|
|
msg_pb.MessageType_COMMIT, |
|
|
|
commitPayload, |
|
|
|
commitPayload, |
|
|
|