Fix sync to preserve transaction type field when creating ChainTransaction
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 3s
Integration Tests / test-service-integration (push) Failing after 9s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 2s
Python Tests / test-python (push) Successful in 13s
Security Scanning / security-scan (push) Successful in 22s

This commit is contained in:
aitbc
2026-04-22 13:44:32 +02:00
parent d5a03acabb
commit 4158508f4d
5 changed files with 571 additions and 1 deletions

View File

@@ -355,6 +355,13 @@ class ChainSync:
logger.warning(f"[SYNC] Failed to apply transaction {tx_hash}: {error_msg}")
# For now, log warning but continue (to be enforced in production)
# Extract type from transaction data
tx_type = tx_data.get("type", "TRANSFER")
if tx_type:
tx_type = tx_type.upper()
else:
tx_type = "TRANSFER"
tx = ChainTransaction(
chain_id=self._chain_id,
tx_hash=tx_hash,
@@ -362,6 +369,7 @@ class ChainSync:
sender=sender_addr,
recipient=recipient_addr,
payload=tx_data,
type=tx_type,
)
session.add(tx)