Start to count peers on server

This commit is contained in:
Adam Schmideg 2020-02-12 13:04:05 +01:00
parent cffc70055d
commit 0bfcc072bd

View file

@ -152,10 +152,10 @@ func TestPriorityClient(t *testing.T) {
defer prio.killAndWait() defer prio.killAndWait()
prioNodeInfo := make(map[string]interface{}) prioNodeInfo := make(map[string]interface{})
prio.callRPC(&prioNodeInfo, "admin_nodeInfo") prio.callRPC(&prioNodeInfo, "admin_nodeInfo")
nodeID := prioNodeInfo["id"].(string) prioNodeID := prioNodeInfo["id"].(string)
// 3_000_000_000 once we move to Go 1.13 // 3_000_000_000 once we move to Go 1.13
tokens := 3000000000 tokens := 3000000000
server.callRPC(nil, "les_addBalance", nodeID, tokens, "foobar") server.callRPC(nil, "les_addBalance", prioNodeID, tokens, "foobar")
prio.addPeer(serverEnode) prio.addPeer(serverEnode)
// Check if priority client is actually syncing and the regular client got kicked out // Check if priority client is actually syncing and the regular client got kicked out
@ -163,6 +163,9 @@ func TestPriorityClient(t *testing.T) {
if len(peers) != 1 { if len(peers) != 1 {
t.Errorf("Expected: # of prio peers == 1, actual: %v", len(peers)) t.Errorf("Expected: # of prio peers == 1, actual: %v", len(peers))
} }
server.callRPC(&peers, "admin_peers")
t.Logf("server peers(%v): %v, prioNodeID: %v", len(peers), peers[0], prioNodeID)
client.callRPC(&peers, "admin_peers") client.callRPC(&peers, "admin_peers")
if len(peers) > 0 { if len(peers) > 0 {
t.Errorf("Expected: # of client peers == 0") t.Errorf("Expected: # of client peers == 0")