Skip to content

Commit

Permalink
Attach version information to each node
Browse files Browse the repository at this point in the history
  • Loading branch information
Hidenori committed Jun 15, 2020
1 parent f5b2957 commit b91e443
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/OverlaySurvey.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import time


def add_new_node(graph, label):
if graph.has_node(label):
def add_new_node(graph, label, version=""):
if graph.has_node(label) and version is "":
return
graph.add_node(label, label=label)
graph.add_node(label, label=label, version=version)


def add_new_edge(graph, u, v):
Expand Down Expand Up @@ -51,7 +51,7 @@ def update_results(graph, parent_info, parent_key, results, is_inbound):

results[direction_tag][other_key] = peer
add_new_node(graph, parent_key)
add_new_node(graph, other_key)
add_new_node(graph, other_key, peer["version"])
add_new_edge(graph, other_key, parent_key)

if "numTotalInboundPeers" in parent_info:
Expand Down Expand Up @@ -124,6 +124,14 @@ def run_survey(args):
duration = int(args.duration)
PARAMS = {'duration': duration}

add_new_node(G,
requests
.get(URL + "/scp?limit=0&fullkeys=true")
.json()
["you"],
requests.get(URL + "/info").json()["info"]["build"])


# reset survey
r = requests.get(url=STOP_SURVEY)

Expand Down

0 comments on commit b91e443

Please sign in to comment.