fix: commit balance changes immediately after state transition and remove sender fallback for 'to' field
Some checks failed
P2P Network Verification / p2p-verification (push) Successful in 8s
Python Tests / test-python (push) Failing after 27s
Security Scanning / security-scan (push) Successful in 1m57s
Integration Tests / test-service-integration (push) Failing after 14m32s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 13s
Blockchain Synchronization Verification / sync-verification (push) Failing after 7s
Some checks failed
P2P Network Verification / p2p-verification (push) Successful in 8s
Python Tests / test-python (push) Failing after 27s
Security Scanning / security-scan (push) Successful in 1m57s
Integration Tests / test-service-integration (push) Failing after 14m32s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 13s
Blockchain Synchronization Verification / sync-verification (push) Failing after 7s
Changed transaction failure logging from warning to error level in PoA proposer. Added immediate session.commit() after successful state transition to persist balance changes. Removed fallback to sender address for 'to' field in submit_transaction as it should be required.
This commit is contained in:
@@ -283,9 +283,13 @@ class PoAProposer:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
self._logger.warning(f"[PROPOSE] Failed to apply transaction {tx.tx_hash}: {error_msg}")
|
self._logger.error(f"[PROPOSE] Failed to apply transaction {tx.tx_hash}: {error_msg}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Commit the balance changes immediately after successful state transition
|
||||||
|
session.commit()
|
||||||
|
self._logger.info(f"[PROPOSE] Committed balance changes for tx {tx.tx_hash}")
|
||||||
|
|
||||||
# Check if transaction already exists in database
|
# Check if transaction already exists in database
|
||||||
existing_tx = session.exec(
|
existing_tx = session.exec(
|
||||||
select(Transaction).where(
|
select(Transaction).where(
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ async def submit_transaction(tx_data: TransactionRequest) -> Dict[str, Any]:
|
|||||||
# _normalize_transaction_data expects "from", not "sender"
|
# _normalize_transaction_data expects "from", not "sender"
|
||||||
tx_data_dict = {
|
tx_data_dict = {
|
||||||
"from": tx_data.sender,
|
"from": tx_data.sender,
|
||||||
"to": tx_data.payload.get("to", tx_data.sender), # Get to from payload or default to sender
|
"to": tx_data.payload.get("to"), # Get to from payload (required field)
|
||||||
"amount": tx_data.payload.get("amount", 0), # Get amount from payload
|
"amount": tx_data.payload.get("amount", 0), # Get amount from payload
|
||||||
"fee": tx_data.fee,
|
"fee": tx_data.fee,
|
||||||
"nonce": tx_data.nonce,
|
"nonce": tx_data.nonce,
|
||||||
|
|||||||
Reference in New Issue
Block a user