From afdefaa62e8545b99d74ab4645a2782d5eb67b89 Mon Sep 17 00:00:00 2001 From: wonkr Date: Mon, 31 Oct 2022 13:02:17 -0400 Subject: [PATCH] EthereumService - add setDisplayName by role --- seedemu/services/EthereumService.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/seedemu/services/EthereumService.py b/seedemu/services/EthereumService.py index 2eec9f4b1..b3050b629 100644 --- a/seedemu/services/EthereumService.py +++ b/seedemu/services/EthereumService.py @@ -1255,9 +1255,30 @@ def getValidatorIds(self) -> List[str]: def getBeaconSetupNodeIp(self) -> str: return self.__beacon_setup_node_address + def setDisplayName(self, node:Node, server: EthereumServer): + displayName = 'Ethereum-{consensus}-{id}{role}' + if node.getDisplayName() != None: + return + else: + consensus = server.getConsensusMechanism().name + id = server.getId() + role = "" + if server.isStartMiner(): + if consensus == "POW": + role += "-Miner" + else: + role += "-Signer" + if server.isBootNode(): + role += "-BootNode" + node.setDisplayName(displayName.format(consensus=consensus, id=id, role=role)) + + + def _doConfigure(self, node: Node, server: EthereumServer): self._log('configuring as{}/{} as an eth node...'.format(node.getAsn(), node.getName())) + self.setDisplayName(node, server) + ifaces = node.getInterfaces() assert len(ifaces) > 0, 'EthereumService::_doConfigure(): node as{}/{} has not interfaces'.format() addr = '{}:{}'.format(str(ifaces[0].getAddress()), server.getBootNodeHttpPort())