pull/61/head
ak 6 years ago
parent 5dadb61c73
commit 3882e2d20a
  1. 6
      identitychain/identitychain.go
  2. 10
      identitychain/identitychain_handler.go
  3. 1
      waitnode/wait_node.go

@ -22,6 +22,12 @@ type IdentityChain struct {
Peer p2p.Peer Peer p2p.Peer
} }
//GlobalBlockchainConfig stores global level blockchain configurations.
type GlobalBlockchainConfig struct {
NumberOfShards int
EpochTimeSecs int16
}
func (IDC *IdentityChain) shard() { func (IDC *IdentityChain) shard() {
return return
} }

@ -43,6 +43,13 @@ func (IDC *IdentityChain) IdentityChainHandler(conn net.Conn) {
actionType := proto_identity.IdentityMessageType(msgType) actionType := proto_identity.IdentityMessageType(msgType)
switch actionType { switch actionType {
case proto_identity.IDENTITY: case proto_identity.IDENTITY:
IDC.registerIdentity(msgPayload)
}
}
}
func (IDC *IdentityChain) registerIdentity(msgPayload []byte) {
identityPayload, err := proto_identity.GetIdentityMessagePayload(msgPayload) identityPayload, err := proto_identity.GetIdentityMessagePayload(msgPayload)
if err != nil { if err != nil {
IDC.log.Error("identity payload not read") IDC.log.Error("identity payload not read")
@ -52,7 +59,4 @@ func (IDC *IdentityChain) IdentityChainHandler(conn net.Conn) {
NewWaitNode := waitnode.DeserializeWaitNode(identityPayload) NewWaitNode := waitnode.DeserializeWaitNode(identityPayload)
IDC.PendingIdentities = append(IDC.PendingIdentities, NewWaitNode) IDC.PendingIdentities = append(IDC.PendingIdentities, NewWaitNode)
fmt.Println(len(IDC.PendingIdentities)) fmt.Println(len(IDC.PendingIdentities))
}
}
} }

@ -15,6 +15,7 @@ import (
type WaitNode struct { type WaitNode struct {
Peer p2p.Peer Peer p2p.Peer
ID uint16 ID uint16
SeedPeers p2p.Peer
} }
// StartServer a server and process the request by a handler. // StartServer a server and process the request by a handler.

Loading…
Cancel
Save