fix: use validated top-level fields in submit_transaction
Some checks failed
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
Security Scanning / security-scan (push) Has been cancelled
Blockchain Synchronization Verification / sync-verification (push) Has been cancelled
Coverage Phase 1 (70% Target) / test-coverage-70 (push) Has been cancelled
Coverage Phase 2 (85% Target) / test-coverage-85 (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-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
Node Failover Simulation / failover-test (push) Has been cancelled
P2P Network Verification / p2p-verification (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled

- Use tx_data.sender and tx_data.recipient instead of reading from payload
- Use tx_data.amount instead of tx_data.payload.get('amount')
- Fixes 'transaction.to is required' error when CLI sends fields at top level
- Pydantic model already validates and aliases from/to to sender/recipient
This commit is contained in:
aitbc
2026-05-26 15:03:13 +02:00
parent 755d5bdeaf
commit 60ea1f91aa

View File

@@ -89,10 +89,11 @@ async def submit_transaction(
chain_id = get_chain_id(None)
# Convert TransactionRequest to dict for normalization
# Use validated top-level fields instead of reading from payload
tx_data_dict = {
"from": tx_data.sender,
"to": tx_data.payload.get("to"),
"amount": tx_data.payload.get("amount", tx_data.payload.get("value", 0)),
"to": tx_data.recipient,
"amount": tx_data.amount,
"fee": tx_data.fee,
"nonce": tx_data.nonce,
"payload": tx_data.payload,