pull/4369/head
frozen 2 years ago committed by Casey Gardiner
parent 6283a319ed
commit af3a293bfe
  1. 2
      api/service/explorer/service.go
  2. 3
      cmd/harmony/main.go
  3. 11
      consensus/consensus_service.go
  4. 7
      consensus/quorum/quorum.go

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

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

@ -213,7 +213,6 @@ func (consensus *Consensus) checkViewID(msg *FBFTMessage) error {
if !msg.HasSingleSender() { if !msg.HasSingleSender() {
return errors.New("Leader message can not have multiple sender keys") 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.LeaderPubKey = msg.SenderPubkeys[0]
consensus.IgnoreViewIDCheck.UnSet() consensus.IgnoreViewIDCheck.UnSet()
consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutConsensus].Start()
@ -397,7 +396,6 @@ func (consensus *Consensus) UpdateConsensusInformation() Mode {
Str("leaderPubKey", leaderPubKey.Bytes.Hex()). Str("leaderPubKey", leaderPubKey.Bytes.Hex()).
Msg("[UpdateConsensusInformation] Most Recent LeaderPubKey Updated Based on BlockChain") Msg("[UpdateConsensusInformation] Most Recent LeaderPubKey Updated Based on BlockChain")
consensus.pubKeyLock.Lock() consensus.pubKeyLock.Lock()
fmt.Println("[UpdateConsensusInformation] Most Recent LeaderPubKey Updated Based on BlockChain", leaderPubKey.Bytes.Hex(), utils.GetPort())
consensus.LeaderPubKey = leaderPubKey consensus.LeaderPubKey = leaderPubKey
consensus.pubKeyLock.Unlock() consensus.pubKeyLock.Unlock()
} }
@ -484,15 +482,6 @@ func (consensus *Consensus) StartFinalityCount() {
consensus.finalityCounter.Store(time.Now().UnixNano()) 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 // FinishFinalityCount calculate the current finality
func (consensus *Consensus) FinishFinalityCount() { func (consensus *Consensus) FinishFinalityCount() {
d := time.Now().UnixNano() d := time.Now().UnixNano()

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

Loading…
Cancel
Save