From d5d97912a01afdeb8a7fd7af47309e88ad18ec92 Mon Sep 17 00:00:00 2001 From: wonkr Date: Thu, 5 Jan 2023 04:49:53 -0600 Subject: [PATCH] update setLabel for ethereum server --- seedemu/services/EthereumService/EthereumServer.py | 4 +++- seedemu/services/EthereumService/EthereumService.py | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/seedemu/services/EthereumService/EthereumServer.py b/seedemu/services/EthereumService/EthereumServer.py index f6b184e4d..4133a0f71 100644 --- a/seedemu/services/EthereumService/EthereumServer.py +++ b/seedemu/services/EthereumService/EthereumServer.py @@ -3,7 +3,7 @@ from .EthEnum import * from .EthUtil import * from typing import Tuple, List -from seedemu.services import EthereumService +from seedemu.services.EthereumService import * from .EthTemplates import EthServerFileTemplates, GethCommandTemplates from .EthTemplates.LighthouseCommandTemplates import * @@ -110,6 +110,8 @@ def install(self, node: Node, eth: EthereumService): node.appendClassName('EthereumService') node.setLabel('node_id', self.getId()) node.setLabel('consensus', self._consensus_mechanism.value) + node.setLabel('blockchain', self._blockchain.getChainName()) + node.setLabel('chain_id', self._blockchain.getChainId()) ifaces = node.getInterfaces() assert len(ifaces) > 0, 'EthereumServer::install: node as{}/{} has no interfaces'.format(node.getAsn(), node.getName()) diff --git a/seedemu/services/EthereumService/EthereumService.py b/seedemu/services/EthereumService/EthereumService.py index b9d839f0f..fd3e6113a 100644 --- a/seedemu/services/EthereumService/EthereumService.py +++ b/seedemu/services/EthereumService/EthereumService.py @@ -205,6 +205,13 @@ def addExternalAccount(self, address: str, balance: int) -> Blockchain: return self + def getChainName(self) -> str: + return self.__chain_name + + def getChainId(self) -> int: + return self.__chain_id + + def _log(self, message: str) -> None: """! @brief Log to stderr.