Files
aitbc/scripts/wrappers/aitbc-blockchain-rpc-wrapper.py
aitbc 7a0054b53d
Some checks failed
CLI Tests / test-cli (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Node Failover Simulation / failover-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Blockchain Synchronization Verification / sync-verification (push) Has been cancelled
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Has been cancelled
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Has been cancelled
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been cancelled
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Has been cancelled
Cross-Chain Functionality Tests / aggregate-results (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Multi-Chain Island Architecture Tests / test-multi-chain-island (push) Has been cancelled
Multi-Node Blockchain Health Monitoring / health-check (push) Has been cancelled
P2P Network Verification / p2p-verification (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Systemd Sync / sync-systemd (push) Successful in 22s
fix: disable block production in RPC-only blockchain service
Prevented RPC service from producing blocks by:
- Added AITBC_FORCE_ENABLE_BLOCK_PRODUCTION environment variable (highest priority)
- Updated _env_value() helper to check multiple env var names in priority order
- Set all block production env vars to false in RPC wrapper script
- Added AITBC_FORCE_ENABLE_BLOCK_PRODUCTION=false to systemd service file
- Fixed CLI get_balance() to use requests library instead of AITBCHTTPClient
- Added 404 handling in
2026-05-04 11:05:32 +02:00

43 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Wrapper script for aitbc-blockchain-rpc 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:{REPO_DIR}/apps/blockchain-node/scripts"
os.environ["DATA_DIR"] = str(DATA_DIR)
os.environ["LOG_DIR"] = str(LOG_DIR)
os.environ["AITBC_FORCE_ENABLE_BLOCK_PRODUCTION"] = "false"
os.environ["ENABLE_BLOCK_PRODUCTION"] = "false"
os.environ["enable_block_production"] = "false"
# Get RPC configuration from environment or use defaults
rpc_host = os.getenv("rpc_bind_host", "0.0.0.0")
rpc_port = os.getenv("rpc_bind_port", "8006")
# Execute the actual service
exec_cmd = [
"/opt/aitbc/venv/bin/python",
"-m",
"uvicorn",
"aitbc_chain.app:app",
"--host",
rpc_host,
"--port",
rpc_port
]
os.execvp(exec_cmd[0], exec_cmd)