refactor idc to bc (beacon chain)

pull/141/head
Minh Doan 6 years ago committed by Minh Doan
parent b335f06dbc
commit 8769333418
  1. 6
      benchmark.go
  2. 6
      client/txgen/main.go
  3. 8
      discovery/discovery.go
  4. 2
      newnode/newnode.go

@ -91,8 +91,8 @@ func main() {
onlyLogTps := flag.Bool("only_log_tps", false, "Only log TPS if true")
//This IP belongs to jenkins.harmony.one
idcIP := flag.String("idc", "127.0.0.1", "IP of the identity chain")
idcPort := flag.String("idc_port", "8081", "port of the identity chain")
bcIP := flag.String("bc", "127.0.0.1", "IP of the identity chain")
bcPort := flag.String("bc_port", "8081", "port of the identity chain")
peerDiscovery := flag.Bool("peer_discovery", false, "Enable Peer Discovery")
//Leader needs to have a minimal number of peers to start consensus
@ -118,7 +118,7 @@ func main() {
//Use Peer Discovery to get shard/leader/peer/...
if *peerDiscovery {
candidateNode := pkg_newnode.New(*ip, *port)
BCPeer := p2p.Peer{IP: *idcIP, Port: *idcPort}
BCPeer := p2p.Peer{IP: *bcIP, Port: *bcPort}
candidateNode.ContactBeaconChain(BCPeer)
shardID = candidateNode.GetShardID()
leader = candidateNode.GetLeader()

@ -52,8 +52,8 @@ func main() {
versionFlag := flag.Bool("version", false, "Output version info")
crossShardRatio := flag.Int("cross_shard_ratio", 30, "The percentage of cross shard transactions.")
idcIP := flag.String("idc", "127.0.0.1", "IP of the identity chain")
idcPort := flag.String("idc_port", "8081", "port of the identity chain")
bcIP := flag.String("bc", "127.0.0.1", "IP of the identity chain")
bcPort := flag.String("bc_port", "8081", "port of the identity chain")
peerDiscovery := flag.Bool("peer_discovery", false, "Enable Peer Discovery")
flag.Parse()
@ -72,7 +72,7 @@ func main() {
if *peerDiscovery {
candidateNode := newnode.New(*ip, *port)
BCPeer := p2p.Peer{IP: *idcIP, Port: *idcPort}
BCPeer := p2p.Peer{IP: *bcIP, Port: *bcPort}
candidateNode.ContactBeaconChain(BCPeer)
peers = nil
clientPeer = &p2p.Peer{IP: *ip, Port: *port}

@ -22,7 +22,7 @@ type ConfigEntry struct {
}
func (config ConfigEntry) String() string {
return fmt.Sprintf("idc: %v:%v", config.IP, config.Port)
return fmt.Sprintf("bc: %v:%v", config.IP, config.Port)
}
// New return new ConfigEntry.
@ -38,14 +38,14 @@ func New(priK kyber.Scalar, pubK kyber.Point) *ConfigEntry {
}
// StartClientMode starts client mode.
func (config *ConfigEntry) StartClientMode(idcIP, idcPort string) error {
func (config *ConfigEntry) StartClientMode(bcIP, bcPort string) error {
config.IP = "myip"
config.Port = "myport"
fmt.Printf("idc ip/port: %v/%v\n", idcIP, idcPort)
fmt.Printf("bc ip/port: %v/%v\n", bcIP, bcPort)
// ...
// TODO: connect to idc, and wait unless acknowledge
// TODO: connect to bc, and wait unless acknowledge
return nil
}

@ -61,7 +61,7 @@ func (node *NewNode) ContactBeaconChain(BCPeer p2p.Peer) {
}
func (node NewNode) String() string {
return fmt.Sprintf("idc: %v:%v and node info %v", node.Self.IP, node.Self.Port, node.SetInfo)
return fmt.Sprintf("bc: %v:%v and node info %v", node.Self.IP, node.Self.Port, node.SetInfo)
}
// RequestBeaconChain requests beacon chain for identity data

Loading…
Cancel
Save