cleanup: remove debug logging from blockchain sync investigation
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 6s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 3s
Deploy to Testnet / deploy-testnet (push) Successful in 1m11s
Integration Tests / test-service-integration (push) Successful in 1m6s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 4s
Multi-Node Stress Testing / stress-test (push) Successful in 5s
Node Failover Simulation / failover-test (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Successful in 15s
Security Scanning / security-scan (push) Successful in 39s
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 6s
Cross-Chain Functionality Tests / test-cross-chain-sync (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-transactions (push) Successful in 2s
Cross-Chain Functionality Tests / test-cross-chain-bridge (push) Has been skipped
Cross-Chain Functionality Tests / test-multi-chain-consensus (push) Successful in 2s
Cross-Chain Functionality Tests / aggregate-results (push) Has been skipped
Cross-Node Transaction Testing / transaction-test (push) Successful in 3s
Deploy to Testnet / deploy-testnet (push) Successful in 1m11s
Integration Tests / test-service-integration (push) Successful in 1m6s
Multi-Node Blockchain Health Monitoring / health-check (push) Failing after 4s
Multi-Node Stress Testing / stress-test (push) Successful in 5s
Node Failover Simulation / failover-test (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Successful in 15s
Security Scanning / security-scan (push) Successful in 39s
This commit is contained in:
@@ -148,7 +148,6 @@ class BlockchainNode:
|
||||
import json
|
||||
block_data = json.loads(block_data)
|
||||
logger.info(f"Importing block for chain {chain_id}: {block_data.get('height')}")
|
||||
print(f"[GOSSIP BLOCK] chain_id={chain_id}, height={block_data.get('height')}, source_url={block_data.get('source_url')}, proposer={block_data.get('proposer')}")
|
||||
sync = ChainSync(session_factory=session_scope, chain_id=chain_id)
|
||||
res = sync.import_block(block_data, transactions=block_data.get("transactions"))
|
||||
logger.info(f"Import result: accepted={res.accepted}, reason={res.reason}")
|
||||
|
||||
@@ -103,10 +103,6 @@ class ChainSync:
|
||||
self._session_factory = session_factory
|
||||
self._chain_id = chain_id
|
||||
self._logger = get_logger(__name__)
|
||||
from .database import get_engine
|
||||
from .config import settings
|
||||
db_path = settings.get_db_path(chain_id)
|
||||
print(f"[SYNC INIT] chain_id={chain_id}, db_path={db_path}")
|
||||
self._max_reorg_depth = max_reorg_depth
|
||||
self._validator = validator or ProposerSignatureValidator()
|
||||
self._validate_signatures = validate_signatures
|
||||
@@ -298,9 +294,7 @@ class ChainSync:
|
||||
if result.accepted:
|
||||
imported += 1
|
||||
else:
|
||||
print(f"[BULK SYNC FAILED] height={block_data.get('height')}, reason={result.reason}, hash={block_data.get('hash')}")
|
||||
logger.warning("Block import failed during bulk", extra={"height": block_data.get("height"), "reason": result.reason, "block_hash": block_data.get("hash")})
|
||||
# Stop on first failure to avoid gaps
|
||||
logger.warning("Block import failed during bulk", extra={"height": block_data.get("height"), "reason": result.reason})
|
||||
return imported
|
||||
|
||||
start_height = end_height + 1
|
||||
@@ -367,14 +361,12 @@ class ChainSync:
|
||||
select(Block).where(Block.chain_id == self._chain_id).order_by(Block.height.desc()).limit(1)
|
||||
).first()
|
||||
our_height = our_head.height if our_head else -1
|
||||
print(f"[DB QUERY] chain_id={self._chain_id}, our_head={our_head}, our_height={our_height}")
|
||||
|
||||
# Case 1: Block extends our chain directly
|
||||
if height == our_height + 1:
|
||||
parent_exists = session.exec(
|
||||
select(Block).where(Block.chain_id == self._chain_id).where(Block.hash == parent_hash)
|
||||
).first()
|
||||
print(f"[IMPORT DEBUG] height={height}, our_height={our_height}, parent_hash={parent_hash}, parent_exists={parent_exists is not None}")
|
||||
if parent_exists or (height == 0 and parent_hash == "0x00"):
|
||||
result = self._append_block(session, block_data, transactions)
|
||||
duration = time.perf_counter() - start
|
||||
|
||||
Reference in New Issue
Block a user