Merge pull request #1035 from rlan35/rj_fork

remove initial fund for our genesis nodes/log cleanup
pull/1038/head
Rongjian Lan 6 years ago committed by GitHub
commit 4e7e7eb1d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      consensus/consensus_service.go
  2. 8
      consensus/consensus_v2.go
  3. 6
      consensus/view_change.go
  4. 8
      internal/memprofiling/lib.go
  5. 2
      node/node_genesis.go

@ -560,7 +560,7 @@ func (consensus *Consensus) checkViewID(msg *PbftMessage) error {
consensus.ignoreViewIDCheck = false consensus.ignoreViewIDCheck = false
consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutConsensus].Start()
utils.GetLogger().Debug("viewID and leaderKey override", "viewID", consensus.viewID, "leaderKey", consensus.LeaderPubKey.SerializeToHexStr()[:20]) utils.GetLogger().Debug("viewID and leaderKey override", "viewID", consensus.viewID, "leaderKey", consensus.LeaderPubKey.SerializeToHexStr()[:20])
utils.GetLogger().Debug("start consensus timeout", "viewID", consensus.viewID, "block", consensus.blockNum) utils.GetLogger().Debug("Start consensus timer", "viewID", consensus.viewID, "block", consensus.blockNum)
return nil return nil
} else if msg.ViewID > consensus.viewID { } else if msg.ViewID > consensus.viewID {
return consensus_engine.ErrViewIDNotMatch return consensus_engine.ErrViewIDNotMatch

@ -572,9 +572,9 @@ func (consensus *Consensus) finalizeCommits() {
if consensus.consensusTimeout[timeoutBootstrap].IsActive() { if consensus.consensusTimeout[timeoutBootstrap].IsActive() {
consensus.consensusTimeout[timeoutBootstrap].Stop() consensus.consensusTimeout[timeoutBootstrap].Stop()
consensus.getLogger().Debug("start consensus timeout; stop bootstrap timeout only once") consensus.getLogger().Debug("start consensus timer; stop bootstrap timer only once")
} else { } else {
consensus.getLogger().Debug("start consensus timeout") consensus.getLogger().Debug("start consensus timer")
} }
consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutConsensus].Start()
@ -665,9 +665,9 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) {
if consensus.consensusTimeout[timeoutBootstrap].IsActive() { if consensus.consensusTimeout[timeoutBootstrap].IsActive() {
consensus.consensusTimeout[timeoutBootstrap].Stop() consensus.consensusTimeout[timeoutBootstrap].Stop()
consensus.getLogger().Debug("start consensus timeout; stop bootstrap timeout only once") consensus.getLogger().Debug("start consensus timer; stop bootstrap timer only once")
} else { } else {
consensus.getLogger().Debug("start consensus timeout") consensus.getLogger().Debug("start consensus timer")
} }
consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutConsensus].Start()
return return

@ -179,7 +179,7 @@ func (consensus *Consensus) startViewChange(viewID uint32) {
consensus.consensusTimeout[timeoutViewChange].SetDuration(duration) consensus.consensusTimeout[timeoutViewChange].SetDuration(duration)
consensus.consensusTimeout[timeoutViewChange].Start() consensus.consensusTimeout[timeoutViewChange].Start()
consensus.getLogger().Debug("start view change timeout", "viewChangingID", consensus.mode.ViewID()) consensus.getLogger().Debug("start view change timer", "viewChangingID", consensus.mode.ViewID())
} }
func (consensus *Consensus) onViewChange(msg *msg_pb.Message) { func (consensus *Consensus) onViewChange(msg *msg_pb.Message) {
@ -366,7 +366,7 @@ func (consensus *Consensus) onViewChange(msg *msg_pb.Message) {
consensus.ResetViewChangeState() consensus.ResetViewChangeState()
consensus.consensusTimeout[timeoutViewChange].Stop() consensus.consensusTimeout[timeoutViewChange].Stop()
consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutConsensus].Start()
consensus.getLogger().Debug("new leader start consensus timeout and stop view change timeout", "viewChangingID", consensus.mode.ViewID()) consensus.getLogger().Debug("new leader start consensus timer and stop view change timer", "viewChangingID", consensus.mode.ViewID())
consensus.getLogger().Debug("I am the new leader", "myKey", consensus.PubKey.SerializeToHexStr(), "viewID", consensus.viewID, "block", consensus.blockNum) consensus.getLogger().Debug("I am the new leader", "myKey", consensus.PubKey.SerializeToHexStr(), "viewID", consensus.viewID, "block", consensus.blockNum)
} }
consensus.getLogger().Debug("onViewChange", "numSigs", len(consensus.viewIDSigs), "needed", consensus.Quorum()) consensus.getLogger().Debug("onViewChange", "numSigs", len(consensus.viewIDSigs), "needed", consensus.Quorum())
@ -485,7 +485,7 @@ func (consensus *Consensus) onNewView(msg *msg_pb.Message) {
consensus.getLogger().Info("onNewView === announce") consensus.getLogger().Info("onNewView === announce")
} }
consensus.getLogger().Debug("new leader changed", "newLeaderKey", consensus.LeaderPubKey.SerializeToHexStr()) consensus.getLogger().Debug("new leader changed", "newLeaderKey", consensus.LeaderPubKey.SerializeToHexStr())
consensus.getLogger().Debug("validator start consensus timeout and stop view change timeout") consensus.getLogger().Debug("validator start consensus timer and stop view change timer")
consensus.consensusTimeout[timeoutConsensus].Start() consensus.consensusTimeout[timeoutConsensus].Start()
consensus.consensusTimeout[timeoutViewChange].Stop() consensus.consensusTimeout[timeoutViewChange].Stop()
} }

@ -22,7 +22,7 @@ const (
// Run garbage collector every 30 minutes. // Run garbage collector every 30 minutes.
gcTime = 10 * time.Minute gcTime = 10 * time.Minute
// Print out memstat every memStatTime. // Print out memstat every memStatTime.
memStatTime = 30 * time.Second memStatTime = 300 * time.Second
) )
// MemProfiling is the struct to watch objects for memprofiling. // MemProfiling is the struct to watch objects for memprofiling.
@ -100,9 +100,9 @@ func MaybeCallGCPeriodically() {
for { for {
select { select {
case <-time.After(gcTime): case <-time.After(gcTime):
PrintMemUsage("mem stats before GC") PrintMemUsage("Memory stats before GC")
runtime.GC() runtime.GC()
PrintMemUsage("mem stats after GC") PrintMemUsage("Memory stats after GC")
} }
} }
}() }()
@ -110,7 +110,7 @@ func MaybeCallGCPeriodically() {
for { for {
select { select {
case <-time.After(memStatTime): case <-time.After(memStatTime):
PrintMemUsage("mem stats") PrintMemUsage("Memory stats")
} }
} }
}() }()

@ -90,7 +90,7 @@ func (node *Node) SetupGenesisBlock(db ethdb.Database, shardID uint32) error {
if shardID == 0 { if shardID == 0 {
// Accounts used by validator/nodes to stake and participate in the network. // Accounts used by validator/nodes to stake and participate in the network.
AddNodeAddressesToGenesisAlloc(genesisAlloc) // AddNodeAddressesToGenesisAlloc(genesisAlloc)
} }
// TODO: add ShardID into chainconfig and change ChainID to NetworkID // TODO: add ShardID into chainconfig and change ChainID to NetworkID

Loading…
Cancel
Save