identity chain is working fixed listen on port

pull/61/head
Alok Kothari 6 years ago
parent b46bdaff40
commit 4a97f541cd
  1. 2
      identitychain/identitychain.go
  2. 20
      identitychain/identitychain_test.go

@ -93,7 +93,6 @@ func (IDC *IdentityChain) UpdateIdentityChain() {
}
func (IDC *IdentityChain) listenOnPort() {
fmt.Print(IDC.Peer.Port)
listen, err := net.Listen("tcp4", ":"+IDC.Peer.Port)
if err != nil {
IDC.log.Crit("Socket listen port failed")
@ -116,5 +115,6 @@ func (IDC *IdentityChain) listenOnPort() {
func New(Peer p2p.Peer) *IdentityChain {
IDC := IdentityChain{}
IDC.Peer = Peer
IDC.log = log.New()
return &IDC
}

@ -1,16 +1,18 @@
package identitychain
import (
"fmt"
"os"
"testing"
"github.com/simple-rules/harmony-benchmark/p2p"
)
func TestConnAlive(test *testing.T) {
// peer := p2p.Peer{Ip: "127.0.0.1", Port: "8080"}
// IDC := New(peer)
// IDC.listenOnPort()
// // conn, err := net.Dial("tcp", IDC.Peer.Ip+":"+IDC.Peer.Port)
// // if err != nil {
// // test.Fatal(err)
// // }
// // defer conn.Close()
func TestIDCFormed(test *testing.T) {
peer := p2p.Peer{Ip: "127.0.0.1", Port: "8080"}
IDC := New(peer)
if IDC == nil {
fmt.Println("IDC not formed.")
os.Exit(1)
}
}

Loading…
Cancel
Save