Add normalization to gossip transaction processing to preserve type field
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 2s
Integration Tests / test-service-integration (push) Failing after 10s
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 11s
Security Scanning / security-scan (push) Has been cancelled
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 2s
Integration Tests / test-service-integration (push) Failing after 10s
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 11s
Security Scanning / security-scan (push) Has been cancelled
This commit is contained in:
@@ -102,6 +102,7 @@ class BlockchainNode:
|
||||
|
||||
async def process_txs():
|
||||
from .mempool import get_mempool
|
||||
from .rpc.router import _normalize_transaction_data
|
||||
mempool = get_mempool()
|
||||
while True:
|
||||
try:
|
||||
@@ -110,6 +111,8 @@ class BlockchainNode:
|
||||
import json
|
||||
tx_data = json.loads(tx_data)
|
||||
chain_id = tx_data.get("chain_id", settings.chain_id)
|
||||
# Normalize transaction data to ensure type field is preserved
|
||||
tx_data = _normalize_transaction_data(tx_data, chain_id)
|
||||
mempool.add(tx_data, chain_id=chain_id)
|
||||
except Exception as exc:
|
||||
logger.error(f"Error processing transaction from gossip: {exc}")
|
||||
|
||||
@@ -308,7 +308,12 @@ async def submit_transaction(tx_data: TransactionRequest) -> Dict[str, Any]:
|
||||
"signature": tx_data.sig
|
||||
}
|
||||
|
||||
_logger.info(f"[ROUTER] Submitting transaction: type={tx_data.type}, normalized_type={tx_data_dict.get('type')}")
|
||||
|
||||
tx_data_dict = _normalize_transaction_data(tx_data_dict, chain_id)
|
||||
|
||||
_logger.info(f"[ROUTER] After normalization: type={tx_data_dict.get('type')}, keys={list(tx_data_dict.keys())}")
|
||||
|
||||
_validate_transaction_admission(tx_data_dict, mempool)
|
||||
|
||||
tx_hash = mempool.add(tx_data_dict, chain_id=chain_id)
|
||||
|
||||
Reference in New Issue
Block a user