Fix RPC block production override and restore coordinator env vars after consolidation
Some checks failed
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Systemd Sync / sync-systemd (push) Has been cancelled

This commit is contained in:
aitbc
2026-04-15 11:32:50 +02:00
parent 734bbd6305
commit 20b96881c4
3 changed files with 11 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
import asyncio
import os
import time
from collections import defaultdict
from contextlib import asynccontextmanager
@@ -101,9 +102,15 @@ async def lifespan(app: FastAPI):
)
await gossip_broker.set_backend(backend)
proposers = []
block_production_override = os.getenv("enable_block_production")
if block_production_override is None:
block_production_override = os.getenv("ENABLE_BLOCK_PRODUCTION")
block_production_enabled = settings.enable_block_production
if block_production_override is not None:
block_production_enabled = block_production_override.strip().lower() in {"1", "true", "yes", "on"}
# Initialize PoA proposer for mining integration
if settings.enable_block_production and settings.proposer_id:
if block_production_enabled and settings.proposer_id:
try:
from .consensus import PoAProposer, ProposerConfig
supported_chains = [c.strip() for c in settings.supported_chains.split(",") if c.strip()]

1
examples/deploy.env.example Symbolic link
View File

@@ -0,0 +1 @@
../scripts/deployment/deploy/.env.deploy.example

View File

@@ -9,10 +9,10 @@ Group=root
WorkingDirectory=/opt/aitbc/apps/blockchain-node
EnvironmentFile=/etc/aitbc/.env
EnvironmentFile=/etc/aitbc/node.env
Environment=enable_block_production=false
Environment=PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin
Environment=PYTHONPATH=/opt/aitbc/apps/blockchain-node/src:/opt/aitbc/apps/blockchain-node/scripts
ExecStart=/opt/aitbc/venv/bin/python -m uvicorn aitbc_chain.app:app --host ${rpc_bind_host} --port ${rpc_bind_port}
UnsetEnvironment=enable_block_production ENABLE_BLOCK_PRODUCTION
ExecStart=/usr/bin/env enable_block_production=false /opt/aitbc/venv/bin/python -m uvicorn aitbc_chain.app:app --host ${rpc_bind_host} --port ${rpc_bind_port}
Restart=always
RestartSec=5
StandardOutput=journal