diff --git a/identitychain/identitychain.go b/identitychain/identitychain.go index 575f45904..c92193d61 100644 --- a/identitychain/identitychain.go +++ b/identitychain/identitychain.go @@ -22,6 +22,12 @@ type IdentityChain struct { Peer p2p.Peer } +//GlobalBlockchainConfig stores global level blockchain configurations. +type GlobalBlockchainConfig struct { + NumberOfShards int + EpochTimeSecs int16 +} + func (IDC *IdentityChain) shard() { return } diff --git a/identitychain/identitychain_handler.go b/identitychain/identitychain_handler.go index f9074e71c..4ac1b6c3f 100644 --- a/identitychain/identitychain_handler.go +++ b/identitychain/identitychain_handler.go @@ -43,16 +43,20 @@ func (IDC *IdentityChain) IdentityChainHandler(conn net.Conn) { actionType := proto_identity.IdentityMessageType(msgType) switch actionType { case proto_identity.IDENTITY: - identityPayload, err := proto_identity.GetIdentityMessagePayload(msgPayload) - if err != nil { - IDC.log.Error("identity payload not read") - } else { - fmt.Println("identity payload read") - } - NewWaitNode := waitnode.DeserializeWaitNode(identityPayload) - IDC.PendingIdentities = append(IDC.PendingIdentities, NewWaitNode) - fmt.Println(len(IDC.PendingIdentities)) + IDC.registerIdentity(msgPayload) } } } + +func (IDC *IdentityChain) registerIdentity(msgPayload []byte) { + identityPayload, err := proto_identity.GetIdentityMessagePayload(msgPayload) + if err != nil { + IDC.log.Error("identity payload not read") + } else { + fmt.Println("identity payload read") + } + NewWaitNode := waitnode.DeserializeWaitNode(identityPayload) + IDC.PendingIdentities = append(IDC.PendingIdentities, NewWaitNode) + fmt.Println(len(IDC.PendingIdentities)) +} diff --git a/waitnode/wait_node.go b/waitnode/wait_node.go index 1c6aa6633..554508130 100644 --- a/waitnode/wait_node.go +++ b/waitnode/wait_node.go @@ -13,8 +13,9 @@ import ( //WaitNode is for nodes waiting to join consensus type WaitNode struct { - Peer p2p.Peer - ID uint16 + Peer p2p.Peer + ID uint16 + SeedPeers p2p.Peer } // StartServer a server and process the request by a handler.