Skip to content

Commit

Permalink
add clientid in startup output
Browse files Browse the repository at this point in the history
  • Loading branch information
oversize committed Oct 14, 2024
1 parent 22180cb commit 581d0d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/blockperf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
configparser module.
"""

import base64
import hashlib
import ipaddress
import json
import logging
Expand Down Expand Up @@ -43,6 +45,7 @@ def __init__(self, config_file: Union[Path, None] = None, verbose=False):
f"Node config: {self.node_config_file}\n"
f"Node logfile: {self.node_logfile}\n"
f"Client Name: {self.name}\n"
f"Client ID: {self.clientid}\n"
f"Networkmagic: {self.network_magic}\n"
f"Public IP: {self.relay_public_ip}:{self.relay_public_port}\n"
# f"..... {blocksample.block_delay} sec\n\n"
Expand Down Expand Up @@ -107,6 +110,14 @@ def check_blockperf_config(self):
"MaximalVerbosity",
), "TracingVerbosity must be NormalVerbosity or MaximalVerbosity"

@property
def clientid(self) -> str:
certid = ""
with open(self.client_cert, mode="r") as f:
cert_string = "".join(f.readlines()[1:-1])
certid = hashlib.sha256(base64.b64decode(cert_string)).hexdigest()
return certid

@property
def broker_host(self) -> str:
broker_host = os.getenv(
Expand Down

0 comments on commit 581d0d0

Please sign in to comment.