Fixed blockchain node HTTP RPC server not responding to requests by: - Updated wrapper script to use combined_main.py instead of main.py - Updated combined_main.py to use port 8006 for HTTP RPC server - combined_main.py runs both blockchain node logic and HTTP RPC server together Root cause: - aitbc_chain.main only runs blockchain node logic (block production, gossip) - HTTP RPC server was not being started - Separate uvicorn process on port 8006 was hung/not responding Solution: - Use combined_main.py which starts both node and HTTP RPC server - Configure HTTP RPC to run on port 8006 (not 8005 to avoid conflict with AI service) - Blockchain node HTTP RPC now responds correctly on port 8006 This fixes the training script wallet balance timeout errors.
32 lines
878 B
Python
Executable File
32 lines
878 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
Wrapper script for aitbc-blockchain-node service
|
|
Uses centralized aitbc utilities for path configuration
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Add aitbc to path
|
|
sys.path.insert(0, str(Path("/opt/aitbc")))
|
|
sys.path.insert(0, str(Path("/opt/aitbc/aitbc")))
|
|
|
|
from aitbc import ENV_FILE, NODE_ENV_FILE, REPO_DIR, DATA_DIR, LOG_DIR
|
|
|
|
# Set up environment using aitbc constants
|
|
os.environ["AITBC_ENV_FILE"] = str(ENV_FILE)
|
|
os.environ["AITBC_NODE_ENV_FILE"] = str(NODE_ENV_FILE)
|
|
os.environ["PYTHONPATH"] = f"{REPO_DIR}/apps/blockchain-node/src"
|
|
os.environ["DATA_DIR"] = str(DATA_DIR)
|
|
os.environ["LOG_DIR"] = str(LOG_DIR)
|
|
|
|
# Execute the actual service
|
|
# Use combined_main to run both blockchain node and HTTP RPC server
|
|
exec_cmd = [
|
|
"/opt/aitbc/venv/bin/python",
|
|
"-m",
|
|
"aitbc_chain.combined_main"
|
|
]
|
|
os.execvp(exec_cmd[0], exec_cmd)
|