@ -192,14 +192,14 @@ func New(host p2p.Host, ShardID string, peers []p2p.Peer, leader p2p.Peer) *Cons
// Initialize cosign bitmap
allPublicKeys := make ( [ ] * bls . PublicKey , 0 )
for _ , validatorPeer := range peers {
allPublicKeys = append ( allPublicKeys , validatorPeer . Bl sPubKey)
allPublicKeys = append ( allPublicKeys , validatorPeer . Consensu sPubKey)
}
allPublicKeys = append ( allPublicKeys , leader . Bl sPubKey)
allPublicKeys = append ( allPublicKeys , leader . Consensu sPubKey)
consensus . PublicKeys = allPublicKeys
prepareBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Bl sPubKey)
commitBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Bl sPubKey)
prepareBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Consensu sPubKey)
commitBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Consensu sPubKey)
consensus . prepareBitmap = prepareBitmap
consensus . commitBitmap = commitBitmap
@ -384,8 +384,8 @@ func (consensus *Consensus) ResetState() {
consensus . prepareSigs = map [ uint32 ] * bls . Sign { }
consensus . commitSigs = map [ uint32 ] * bls . Sign { }
prepareBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Bl sPubKey)
commitBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Bl sPubKey)
prepareBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Consensu sPubKey)
commitBitmap , _ := bls_cosi . NewMask ( consensus . PublicKeys , consensus . leader . Consensu sPubKey)
consensus . prepareBitmap = prepareBitmap
consensus . commitBitmap = commitBitmap
@ -421,7 +421,7 @@ func (consensus *Consensus) AddPeers(peers []*p2p.Peer) int {
}
consensus . validators . Store ( utils . GetUniqueIDFromPeer ( * peer ) , * peer )
consensus . pubKeyLock . Lock ( )
consensus . PublicKeys = append ( consensus . PublicKeys , peer . Bl sPubKey)
consensus . PublicKeys = append ( consensus . PublicKeys , peer . Consensu sPubKey)
consensus . pubKeyLock . Unlock ( )
// utils.GetLogInstance().Debug("[SYNC]", "new peer added", peer)
}
@ -458,7 +458,7 @@ func (consensus *Consensus) RemovePeers(peers []p2p.Peer) int {
for i , pp := range newList {
// Not Found the pubkey, if found pubkey, ignore it
if reflect . DeepEqual ( peer . Bl sPubKey, pp ) {
if reflect . DeepEqual ( peer . Consensu sPubKey, pp ) {
// consensus.Log.Debug("RemovePeers", "i", i, "pp", pp, "peer.PubKey", peer.PubKey)
newList = append ( newList [ : i ] , newList [ i + 1 : ] ... )
count2 ++
@ -473,7 +473,7 @@ func (consensus *Consensus) RemovePeers(peers []p2p.Peer) int {
// Or the shard won't be able to reach consensus if public keys are mismatch
validators := consensus . GetValidatorPeers ( )
pong := proto_discovery . NewPongMessage ( validators , consensus . PublicKeys , consensus . leader . Bl sPubKey)
pong := proto_discovery . NewPongMessage ( validators , consensus . PublicKeys , consensus . leader . Consensu sPubKey)
buffer := pong . ConstructPongMessage ( )
consensus . host . SendMessageToGroups ( [ ] p2p . GroupID { p2p . GroupIDBeacon } , host . ConstructP2pMessage ( byte ( 17 ) , buffer ) )
@ -497,7 +497,7 @@ func (consensus *Consensus) DebugPrintValidators() {
count := 0
consensus . validators . Range ( func ( k , v interface { } ) bool {
if p , ok := v . ( p2p . Peer ) ; ok {
str2 := fmt . Sprintf ( "%s" , p . Bl sPubKey. Serialize ( ) )
str2 := fmt . Sprintf ( "%s" , p . Consensu sPubKey. Serialize ( ) )
utils . GetLogInstance ( ) . Debug ( "validator:" , "IP" , p . IP , "Port" , p . Port , "VID" , p . ValidatorID , "Key" , str2 )
count ++
return true
@ -653,11 +653,11 @@ func (consensus *Consensus) signAndMarshalConsensusMessage(message *msg_pb.Messa
// SetLeaderPubKey deserialize the public key of consensus leader
func ( consensus * Consensus ) SetLeaderPubKey ( k [ ] byte ) error {
consensus . leader . Bl sPubKey = & bls . PublicKey { }
return consensus . leader . Bl sPubKey. Deserialize ( k )
consensus . leader . Consensu sPubKey = & bls . PublicKey { }
return consensus . leader . Consensu sPubKey. Deserialize ( k )
}
// GetLeaderPubKey returns the public key of consensus leader
func ( consensus * Consensus ) GetLeaderPubKey ( ) * bls . PublicKey {
return consensus . leader . Bl sPubKey
return consensus . leader . Consensu sPubKey
}