diff --git a/Processes/dan_wallet_daemon.py b/Processes/dan_wallet_daemon.py index 341e6d6..b8c2847 100644 --- a/Processes/dan_wallet_daemon.py +++ b/Processes/dan_wallet_daemon.py @@ -108,7 +108,7 @@ def claim_burn(self, burn: Any, account: Any): def get_balances(self, account: Any): return self.call("accounts.get_balances", [account["account"]["name"], True]) - def transfer(self, account: Any, amount: int, resource_address: Any, destination_publickey: Any, fee: Optional[int]): + def transfer(self, account: Any, amount: int, resource_address: Any, destination_publickey: Any, fee: Optional[int], dry_run: bool = False): id = stats.start_run("accounts.transfer") res = self.call("accounts.transfer", [account["account"]["name"], amount, resource_address, destination_publickey, fee]) stats.end_run(id) diff --git a/Processes/indexer.py b/Processes/indexer.py index d7cce0e..3c70e67 100644 --- a/Processes/indexer.py +++ b/Processes/indexer.py @@ -53,8 +53,8 @@ def __init__(self, indexer_id: int, base_node_grpc_port: int, peers=[]): "indexer.p2p.allow_test_addresses=true", "-p", f"{NETWORK}.p2p.seeds.peer_seeds={','.join(peers)}", - "-p", - f"indexer.p2p.public_addresses={self.public_adress}", + # "-p", + # f"indexer.p2p.public_addresses={self.public_adress}", "-p", f"indexer.json_rpc_address={self.json_listen_address}", "-p", diff --git a/Processes/validator_node.py b/Processes/validator_node.py index 12ee14d..fabda2a 100644 --- a/Processes/validator_node.py +++ b/Processes/validator_node.py @@ -74,8 +74,8 @@ def __init__(self, base_node_grpc_port, wallet_grpc_port, node_id, peers=[]): f"{NETWORK}.p2p.seeds.peer_seeds={','.join(peers)}", # "-p", # f"validator_node.p2p.public_address={self.public_adress}", - "-p", - f"validator_node.public_address={self.public_address}", + # "-p", + # f"validator_node.public_address={self.public_address}", "-p", f"validator_node.json_rpc_address={self.json_listen_address}", "-p", @@ -97,14 +97,15 @@ def __init__(self, base_node_grpc_port, wallet_grpc_port, node_id, peers=[]): self.jrpc_client = JrpcValidatorNode(f"http://{self.json_connect_address}") def get_address(self) -> str: - validator_node_id_file_name = os.path.join(DATA_FOLDER, self.name, NETWORK, "validator_node_id.json") - while not os.path.exists(validator_node_id_file_name): - time.sleep(1) - f = open(validator_node_id_file_name, "rt") - content = "".join(f.readlines()) - node_id, public_key, public_address = re.search(r'"node_id":"(.*?)","public_key":"(.*?)".*"public_addresses":\["(.*?)"', content).groups() - public_address = public_address.replace("\\/", "/") - return f"{public_key}::{public_address}" + return "" + # validator_node_id_file_name = os.path.join(DATA_FOLDER, self.name, NETWORK, "validator_node_id.json") + # while not os.path.exists(validator_node_id_file_name): + # time.sleep(1) + # f = open(validator_node_id_file_name, "rt") + # content = "".join(f.readlines()) + # node_id, public_key, public_address = re.search(r'"node_id":"(.*?)","public_key":"(.*?)".*"public_addresses":\["(.*?)"', content).groups() + # public_address = public_address.replace("\\/", "/") + # return f"{public_key}::{public_address}" def register(self, local_ip: str): if USE_BINARY_EXECUTABLE: @@ -123,6 +124,8 @@ def register(self, local_ip: str): *run, "--vn-daemon-jrpc-endpoint", f"/ip4/{local_ip}/tcp/{self.json_rpc_port}", + # "--validator-maturity", + # "1000", "vn", "register", "d6d21f5c18406b390ce405fd21773d90bddb221b38c950dccf8f26840937004d", @@ -133,12 +136,12 @@ def register(self, local_ip: str): ) if self.cli_process != 0: raise Exception("Validator node cli registration process failed") - print(f"Validator node register: {self.cli_process}") + print(f"Validator node register: ok") else: self.cli_process = SubprocessWrapper.call(self.exec_cli) - print(f"Validator node register: {self.cli_process}") if self.cli_process != 0: raise Exception("Validator node cli registration process failed") + print(f"Validator node register: ok") def get_info_for_ui(self): return {"http": self.http_connect_address, "jrpc": self.json_connect_address} diff --git a/main.py b/main.py index 4b75f7e..b74c1b8 100644 --- a/main.py +++ b/main.py @@ -218,7 +218,8 @@ def cli_loop(): # this is how many times we send the funds back and forth for each of two wallets -def stress_test(num_of_tx: int = 1): +def stress_test(num_of_tx: int = 1, dry_run: bool = True): + # The dry run is ignored for now, once there will be a change in the PR I will update this. global base_node, miner, tari_connector_sample, server global total_num_of_tx total_num_of_tx = 0 @@ -234,7 +235,7 @@ def send_tx(account0: int, account1: int): print(f"tx {account0} -> {account1} ({i})") # dan0.jrpc_client.confidential_transfer(acc0, 1, res_addr, public_key1, 2000) # dan1.jrpc_client.confidential_transfer(acc1, 1, res_addr, public_key0, 2000) - dan0.jrpc_client.transfer(acc0, 2000, res_addr, public_key1, 2000) + dan0.jrpc_client.transfer(acc0, 2000, res_addr, public_key1, 2000, dry_run) total_num_of_tx += 1 # dan_wallets[dst_id].jrpc_client.transfer(dst_account, 1, res_addr, src_public_key, 2000) @@ -419,9 +420,9 @@ def spawn_wallet(d_id: int): def create_account(i: int, amount: int): name = {"Name": f"TestAccount_{i}"} dan_wallet_jrpc = dan_wallets[i % SPAWN_WALLETS].jrpc_client - print(f"Account {name} creation started") + print(f"Account {name["Name"]} creation started") dan_wallet_jrpc.create_free_test_coins(name, amount) - print(f"Account {name} created") + print(f"Account {name["Name"]} created") threads.set_semaphore_limit(1) for i in range(CREATE_ACCOUNTS):