pull/4351/head
frozen 2 years ago committed by Casey Gardiner
parent 91ecc7367b
commit 934ca73c5e
  1. 2
      api/service/explorer/service.go
  2. 3
      cmd/harmony/main.go
  3. 21
      consensus/consensus_service.go
  4. 7
      consensus/quorum/quorum.go

@ -115,8 +115,6 @@ func (s *Service) Run() *http.Server {
s.router = mux.NewRouter()
fmt.Println("++", addr)
// Set up router for addresses.
// Fetch addresses request, accepts parameter size: how much addresses to read,
// parameter prefix: from which address prefix start

@ -265,8 +265,6 @@ func setupNodeLog(config harmonyconfig.HarmonyConfig) {
func setupNodeAndRun(hc harmonyconfig.HarmonyConfig) {
var err error
fmt.Println("OS: ", os.Args)
nodeconfigSetShardSchedule(hc)
nodeconfig.SetShardingSchedule(shard.Schedule)
nodeconfig.SetVersion(getHarmonyVersion())
@ -787,7 +785,6 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi
// Set the consensus ID to be the current block number
viewID := currentNode.Blockchain().CurrentBlock().Header().ViewID().Uint64()
fmt.Println("viewID:", viewID)
currentConsensus.SetViewIDs(viewID + 1)
utils.Logger().Info().
Uint64("viewID", viewID).

@ -219,7 +219,6 @@ func (consensus *Consensus) checkViewID(msg *FBFTMessage) error {
if !msg.HasSingleSender() {
return errors.New("Leader message can not have multiple sender keys")
}
fmt.Println("[checkViewID] Set LEADEER PUB KEY ", msg.SenderPubkeys[0].Bytes.Hex(), utils.GetPort())
consensus.LeaderPubKey = msg.SenderPubkeys[0]
consensus.IgnoreViewIDCheck.UnSet()
consensus.consensusTimeout[timeoutConsensus].Start()
@ -403,7 +402,6 @@ func (consensus *Consensus) UpdateConsensusInformation() Mode {
Str("leaderPubKey", leaderPubKey.Bytes.Hex()).
Msg("[UpdateConsensusInformation] Most Recent LeaderPubKey Updated Based on BlockChain")
consensus.pubKeyLock.Lock()
fmt.Println("[UpdateConsensusInformation] Most Recent LeaderPubKey Updated Based on BlockChain", leaderPubKey.Bytes.Hex(), utils.GetPort())
consensus.LeaderPubKey = leaderPubKey
consensus.pubKeyLock.Unlock()
}
@ -498,15 +496,6 @@ func (consensus *Consensus) StartFinalityCount() {
consensus.finalityCounter.Store(time.Now().UnixNano())
}
//func (consensus *Consensus) ReshardingNextLeader(newblock *types.Block) {
// consensus.pubKeyLock.Lock()
// fmt.Println("nextBlock1 ", newblock.Header().Number().Uint64(), " ", consensus.LeaderPubKey.Bytes.Hex())
// consensus.LeaderPubKey = consensus.getNextLeaderKey(consensus.GetCurBlockViewID() + 1)
// fmt.Println("nextBlock2 ", newblock.Header().Number().Uint64(), " ", consensus.LeaderPubKey.Bytes.Hex())
// consensus.pubKeyLock.Unlock()
//
//}
// FinishFinalityCount calculate the current finality
func (consensus *Consensus) FinishFinalityCount() {
d := time.Now().UnixNano()
@ -622,13 +611,3 @@ func (consensus *Consensus) getLogger() *zerolog.Logger {
Logger()
return &logger
}
func UpdatePublicKeyDefault(consensus *Consensus) {
if allKeys := consensus.Decider.Participants(); len(allKeys) > 0 {
consensus.LeaderPubKey = &allKeys[0]
}
}
func UpdatePublicKeyRotate(consensus *Consensus) {
//consensus
}

@ -231,17 +231,12 @@ func (s *cIdentities) NthNextHmy(instance shardingconfig.Instance, pubKey *bls.P
Msg("[NthNextHmy] pubKey not found")
}
numNodes := instance.NumHarmonyOperatedNodesPerShard()
//fmt.Println("??idx:", idx, numNodes)
// sanity check to avoid out of bound access
if numNodes <= 0 || numNodes > len(s.publicKeys) {
numNodes = len(s.publicKeys)
}
idx = (idx + next) % numNodes
//fmt.Println("-------idx:", idx)
new := &s.publicKeys[idx]
fmt.Println("NthNextHmy: ", pubKey.Bytes.Hex(), new.Bytes.Hex())
return found, new
return found, &s.publicKeys[idx]
}
// NthNextHmyExt return the Nth next pubkey of Harmony + allowlist nodes, next can be negative number

Loading…
Cancel
Save