From d0832dbbb11350a2c0cb7c171765a4a784784455 Mon Sep 17 00:00:00 2001 From: ak Date: Tue, 19 Mar 2019 17:11:52 -0700 Subject: [PATCH] addressing leo and chao comments --- cmd/harmony/main.go | 17 +++++++---------- internal/configs/node/config.go | 2 +- node/node.go | 1 - node/node_syncing.go | 1 - test/deploy.sh | 4 ++-- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index fcea3a7f7..b42f8f4ba 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -8,7 +8,6 @@ import ( "path" "runtime" "strconv" - "sync" "time" "github.com/ethereum/go-ethereum/ethdb" @@ -27,11 +26,10 @@ import ( ) var ( - version string - builtBy string - builtAt string - commit string - stateMutex sync.Mutex + version string + builtBy string + builtAt string + commit string ) // InitLDBDatabase initializes a LDBDatabase. isBeacon=true will return the beacon chain database for normal shard nodes @@ -86,9 +84,9 @@ var ( keyFile = flag.String("key", "./.hmykey", "the private key file of the harmony node") // isBeacon indicates this node is a beacon chain node isBeacon = flag.Bool("is_beacon", false, "true means this node is a beacon chain node") - // isArchival indicates this node is a archival node that will save and archive current blockchain + // isArchival indicates this node is an archival node that will save and archive current blockchain isArchival = flag.Bool("is_archival", false, "true means this node is a archival node") - // isNewNode indicates this node is a new node + //isNewNode indicates this node is a new node isNewNode = flag.Bool("is_newnode", false, "true means this node is a new node") accountIndex = flag.Int("account_index", 0, "the index of the staking account to use") // isLeader indicates this node is a beacon chain leader node during the bootstrap process @@ -263,7 +261,6 @@ func main() { if *isArchival { currentNode, nodeConfig = setupArchivalNode(nodeConfig) loggingInit(*logFolder, nodeConfig.StringRole, *ip, *port, *onlyLogTps) - log.Info("New Harmony Node ====", "Role", currentNode.NodeConfig.Role(), "multiaddress", fmt.Sprintf("/ip4/%s/tcp/%s/p2p/%s", *ip, *port, nodeConfig.Host.GetID().Pretty())) go currentNode.DoBeaconSyncing() } else { // Start Profiler for leader if profile argument is on @@ -280,9 +277,9 @@ func main() { } // Init logging. loggingInit(*logFolder, nodeConfig.StringRole, *ip, *port, *onlyLogTps) - log.Info("New Harmony Node ====", "Role", currentNode.NodeConfig.Role(), "multiaddress", fmt.Sprintf("/ip4/%s/tcp/%s/p2p/%s", *ip, *port, nodeConfig.Host.GetID().Pretty())) go currentNode.SupportSyncing() } + log.Info("New Harmony Node ====", "Role", currentNode.NodeConfig.Role(), "multiaddress", fmt.Sprintf("/ip4/%s/tcp/%s/p2p/%s", *ip, *port, nodeConfig.Host.GetID().Pretty())) currentNode.ServiceManagerSetup() currentNode.RunServices() currentNode.StartServer() diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index df8106671..871f0cdd4 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -143,7 +143,7 @@ func (conf *ConfigType) SetIsLeader(b bool) { conf.isLeader = b } -// SetIsArchival set the isLeader configuration +// SetIsArchival set the isArchival configuration func (conf *ConfigType) SetIsArchival(b bool) { conf.isArchival = b } diff --git a/node/node.go b/node/node.go index 2d5fc4a62..b9cb89c0d 100644 --- a/node/node.go +++ b/node/node.go @@ -247,7 +247,6 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, db ethdb.Database) *N node.BlockChannel = make(chan *types.Block) node.ConfirmedBlockChannel = make(chan *types.Block) node.BeaconBlockChannel = make(chan *types.Block) - utils.GetLogInstance().Debug("All Channels setup for ", "node", node.SelfPeer) node.TxPool = core.NewTxPool(core.DefaultTxPoolConfig, params.TestChainConfig, chain) node.Worker = worker.New(params.TestChainConfig, chain, node.Consensus, pki.GetAddressFromPublicKey(node.SelfPeer.ConsensusPubKey), node.Consensus.ShardID) diff --git a/node/node_syncing.go b/node/node_syncing.go index 2146fb753..1e0631884 100644 --- a/node/node_syncing.go +++ b/node/node_syncing.go @@ -70,7 +70,6 @@ func (node *Node) DoBeaconSyncing() { for { select { case beaconBlock := <-node.BeaconBlockChannel: - utils.GetLogInstance().Debug("[SYNC] Received BeaconBlockChannel Ping for Sync") if node.beaconSync == nil { node.beaconSync = syncing.CreateStateSync(node.SelfPeer.IP, node.SelfPeer.Port) node.beaconSync.CreateSyncConfig(node.GetBeaconSyncingPeers()) diff --git a/test/deploy.sh b/test/deploy.sh index a7f2504d0..e8777c346 100755 --- a/test/deploy.sh +++ b/test/deploy.sh @@ -177,8 +177,8 @@ else sleep $DURATION fi -#save bc_config.json +# save bc_config.json [ -e bc_config.json ] && cp -f bc_config.json $log_folder cleanup -check_result \ No newline at end of file +check_result