addressing leo and chao comments

pull/601/head
ak 6 years ago
parent dd65bf4673
commit d0832dbbb1
  1. 9
      cmd/harmony/main.go
  2. 2
      internal/configs/node/config.go
  3. 1
      node/node.go
  4. 1
      node/node_syncing.go
  5. 2
      test/deploy.sh

@ -8,7 +8,6 @@ import (
"path" "path"
"runtime" "runtime"
"strconv" "strconv"
"sync"
"time" "time"
"github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/ethdb"
@ -31,7 +30,6 @@ var (
builtBy string builtBy string
builtAt string builtAt string
commit string commit string
stateMutex sync.Mutex
) )
// InitLDBDatabase initializes a LDBDatabase. isBeacon=true will return the beacon chain database for normal shard nodes // 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") keyFile = flag.String("key", "./.hmykey", "the private key file of the harmony node")
// isBeacon indicates this node is a beacon chain 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") 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") 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") 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") 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 // isLeader indicates this node is a beacon chain leader node during the bootstrap process
@ -263,7 +261,6 @@ func main() {
if *isArchival { if *isArchival {
currentNode, nodeConfig = setupArchivalNode(nodeConfig) currentNode, nodeConfig = setupArchivalNode(nodeConfig)
loggingInit(*logFolder, nodeConfig.StringRole, *ip, *port, *onlyLogTps) 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() go currentNode.DoBeaconSyncing()
} else { } else {
// Start Profiler for leader if profile argument is on // Start Profiler for leader if profile argument is on
@ -280,9 +277,9 @@ func main() {
} }
// Init logging. // Init logging.
loggingInit(*logFolder, nodeConfig.StringRole, *ip, *port, *onlyLogTps) 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() 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.ServiceManagerSetup()
currentNode.RunServices() currentNode.RunServices()
currentNode.StartServer() currentNode.StartServer()

@ -143,7 +143,7 @@ func (conf *ConfigType) SetIsLeader(b bool) {
conf.isLeader = b conf.isLeader = b
} }
// SetIsArchival set the isLeader configuration // SetIsArchival set the isArchival configuration
func (conf *ConfigType) SetIsArchival(b bool) { func (conf *ConfigType) SetIsArchival(b bool) {
conf.isArchival = b conf.isArchival = b
} }

@ -247,7 +247,6 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, db ethdb.Database) *N
node.BlockChannel = make(chan *types.Block) node.BlockChannel = make(chan *types.Block)
node.ConfirmedBlockChannel = make(chan *types.Block) node.ConfirmedBlockChannel = make(chan *types.Block)
node.BeaconBlockChannel = 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.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) node.Worker = worker.New(params.TestChainConfig, chain, node.Consensus, pki.GetAddressFromPublicKey(node.SelfPeer.ConsensusPubKey), node.Consensus.ShardID)

@ -70,7 +70,6 @@ func (node *Node) DoBeaconSyncing() {
for { for {
select { select {
case beaconBlock := <-node.BeaconBlockChannel: case beaconBlock := <-node.BeaconBlockChannel:
utils.GetLogInstance().Debug("[SYNC] Received BeaconBlockChannel Ping for Sync")
if node.beaconSync == nil { if node.beaconSync == nil {
node.beaconSync = syncing.CreateStateSync(node.SelfPeer.IP, node.SelfPeer.Port) node.beaconSync = syncing.CreateStateSync(node.SelfPeer.IP, node.SelfPeer.Port)
node.beaconSync.CreateSyncConfig(node.GetBeaconSyncingPeers()) node.beaconSync.CreateSyncConfig(node.GetBeaconSyncingPeers())

@ -177,7 +177,7 @@ else
sleep $DURATION sleep $DURATION
fi fi
#save bc_config.json # save bc_config.json
[ -e bc_config.json ] && cp -f bc_config.json $log_folder [ -e bc_config.json ] && cp -f bc_config.json $log_folder
cleanup cleanup

Loading…
Cancel
Save