From dd747a10deb10272167e40eeb9a654e4b1af6990 Mon Sep 17 00:00:00 2001 From: OWL Date: Tue, 26 May 2026 22:35:48 +0200 Subject: [PATCH 1/2] Fix exchange.py syntax error and implement genesis sync-from-hub --- cli/aitbc_cli/commands/exchange.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli/aitbc_cli/commands/exchange.py b/cli/aitbc_cli/commands/exchange.py index 6c8336ed..fa3dbbc3 100755 --- a/cli/aitbc_cli/commands/exchange.py +++ b/cli/aitbc_cli/commands/exchange.py @@ -877,6 +877,8 @@ def pairs(ctx, exchange: str): if len(base_currencies[base]) > 10: success(f" ... and {len(base_currencies[base]) - 10} more") + except Exception as e: + error(f"Error fetching pairs: {e}") @exchange.command() From c8b83298d496c4d9a13fdce88f8bf8d84f0c5807 Mon Sep 17 00:00:00 2001 From: OWL Date: Tue, 26 May 2026 22:49:51 +0200 Subject: [PATCH 2/2] Fix poa.py genesis.json format compatibility and exchange.py syntax error - poa.py: Support both flat and nested genesis.json formats (block.hash vs genesis_hash) - exchange.py: Fix incomplete try/except in pairs function - genesis.json: Updated to match CLI expected format with nested block structure --- apps/blockchain-node/src/aitbc_chain/consensus/poa.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/blockchain-node/src/aitbc_chain/consensus/poa.py b/apps/blockchain-node/src/aitbc_chain/consensus/poa.py index c9a42d2b..bfe5e11c 100755 --- a/apps/blockchain-node/src/aitbc_chain/consensus/poa.py +++ b/apps/blockchain-node/src/aitbc_chain/consensus/poa.py @@ -484,11 +484,12 @@ class PoAProposer: self._logger.error(f"Genesis file not found at /var/lib/aitbc/data/{self._config.chain_id}/genesis.json. Cannot create genesis block without genesis.json file.") raise RuntimeError(f"Genesis file required but not found for chain {self._config.chain_id}. Please create genesis.json at /var/lib/aitbc/data/{self._config.chain_id}/genesis.json") - # Extract genesis data from file - genesis_hash = local_genesis_data.get("genesis_hash") - genesis_timestamp = local_genesis_data.get("timestamp") - genesis_state_root = local_genesis_data.get("state_root") - genesis_allocations = local_genesis_data.get("allocations", []) + # Extract genesis data from file (support both flat and nested formats) + block_data = local_genesis_data.get("block", {}) + genesis_hash = local_genesis_data.get("genesis_hash") or block_data.get("hash") + genesis_timestamp = local_genesis_data.get("timestamp") or block_data.get("timestamp") + genesis_state_root = local_genesis_data.get("state_root") or block_data.get("state_root") + genesis_allocations = local_genesis_data.get("allocations", block_data.get("allocations", [])) if not genesis_hash or not genesis_timestamp or not genesis_state_root: self._logger.error(f"Genesis file missing required fields: genesis_hash, timestamp, or state_root")