Skip to content

Commit

Permalink
Add validator client and node public addresses
Browse files Browse the repository at this point in the history
- Add the public client and node addresses to the output of `fetch-validator-status`.
  - The public addresses come from the pool information.  The nodes themselves are unaware of their public addresses.  The addresses are added to the node summary in order to ensure the results from `get_validator_info` are unmodified.
  - Requires a version of `bcgovimages/von-image:next-1` built with hyperledger/indy-vdr@ce0e7c4.  The address fields will not be included in the summary results when using a previous version of `bcgovimages/von-image:next-1`.

Signed-off-by: Wade Barnes <[email protected]>
  • Loading branch information
WadeBarnes committed Sep 27, 2020
1 parent d043731 commit 61100aa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions fetch-validator-status/fetch_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def seed_as_bytes(seed):
async def fetch_status(genesis_path: str, nodes: str = None, ident: DidKey = None, status_only: bool = False, alerts_only: bool = False):
pool = await open_pool(transactions_path=genesis_path)
result = []
verifiers = {}

if ident:
request = build_get_validator_info_request(ident.did)
Expand All @@ -62,6 +63,11 @@ async def fetch_status(genesis_path: str, nodes: str = None, ident: DidKey = Non
if nodes:
from_nodes = nodes.split(",")
response = await pool.submit_action(request, node_aliases = from_nodes)
try:
# Introduced in https://github.com/hyperledger/indy-vdr/commit/ce0e7c42491904e0d563f104eddc2386a52282f7
verifiers = await pool.get_verifiers()
except AttributeError:
pass

primary = ""
packages = {}
Expand All @@ -73,6 +79,7 @@ async def fetch_status(genesis_path: str, nodes: str = None, ident: DidKey = Non
info = []
entry = {"name": node}
try:
await get_node_addresses(entry, verifiers)
jsval = json.loads(val)
if not primary:
primary = await get_primary_name(jsval, node)
Expand Down Expand Up @@ -119,6 +126,15 @@ async def fetch_status(genesis_path: str, nodes: str = None, ident: DidKey = Non
print(json.dumps(result, indent=2))


async def get_node_addresses(entry: any, verifiers: any) -> any:
if verifiers:
node_name = entry["name"]
if "client_addr" in verifiers[node_name]:
entry["client-address"] = verifiers[node_name]["client_addr"]
if "node_addr" in verifiers[node_name]:
entry["node-address"] = verifiers[node_name]["node_addr"]


async def detect_connection_issues(result: any) -> any:
for node in result:
connection_errors = []
Expand Down

0 comments on commit 61100aa

Please sign in to comment.