pull/61/head
ak 6 years ago
parent 5dadb61c73
commit 3882e2d20a
  1. 6
      identitychain/identitychain.go
  2. 22
      identitychain/identitychain_handler.go
  3. 5
      waitnode/wait_node.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
}

@ -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))
}

@ -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.

Loading…
Cancel
Save