Add logging to router to diagnose transaction value issue
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 21s
Integration Tests / test-service-integration (push) Successful in 1m24s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 9s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Failing after 31s
Security Scanning / security-scan (push) Successful in 1m1s
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Failing after 21s
Integration Tests / test-service-integration (push) Successful in 1m24s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 9s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Failing after 31s
Security Scanning / security-scan (push) Successful in 1m1s
This commit is contained in:
@@ -196,6 +196,7 @@ class TransactionRequest(BaseModel):
|
|||||||
fee: int = Field(ge=0)
|
fee: int = Field(ge=0)
|
||||||
payload: Dict[str, Any]
|
payload: Dict[str, Any]
|
||||||
sig: Optional[str] = Field(default=None, description="Signature payload")
|
sig: Optional[str] = Field(default=None, description="Signature payload")
|
||||||
|
value: Optional[int] = Field(default=None, description="Transaction value (amount to transfer)")
|
||||||
|
|
||||||
@model_validator(mode="after")
|
@model_validator(mode="after")
|
||||||
def normalize_type(self) -> "TransactionRequest": # type: ignore[override]
|
def normalize_type(self) -> "TransactionRequest": # type: ignore[override]
|
||||||
@@ -293,6 +294,7 @@ async def submit_transaction(tx_data: TransactionRequest) -> Dict[str, Any]:
|
|||||||
from ..mempool import get_mempool
|
from ..mempool import get_mempool
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
_logger.info(f"Received transaction request: sender={tx_data.sender}, value={tx_data.value}, payload={tx_data.payload}")
|
||||||
mempool = get_mempool()
|
mempool = get_mempool()
|
||||||
chain_id = get_chain_id(None)
|
chain_id = get_chain_id(None)
|
||||||
|
|
||||||
@@ -309,9 +311,16 @@ async def submit_transaction(tx_data: TransactionRequest) -> Dict[str, Any]:
|
|||||||
"signature": tx_data.sig
|
"signature": tx_data.sig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_logger.info(f"Initial tx_data_dict amount: {tx_data_dict['amount']}")
|
||||||
|
|
||||||
# If value is provided at top level, use it instead of payload.amount
|
# If value is provided at top level, use it instead of payload.amount
|
||||||
if hasattr(tx_data, 'value') and tx_data.value is not None:
|
if hasattr(tx_data, 'value') and tx_data.value is not None:
|
||||||
|
_logger.info(f"Using top-level value: {tx_data.value}")
|
||||||
tx_data_dict["amount"] = tx_data.value
|
tx_data_dict["amount"] = tx_data.value
|
||||||
|
else:
|
||||||
|
_logger.info(f"No top-level value, using payload amount: {tx_data_dict['amount']}")
|
||||||
|
|
||||||
|
_logger.info(f"Final tx_data_dict amount: {tx_data_dict['amount']}")
|
||||||
|
|
||||||
tx_data_dict = _normalize_transaction_data(tx_data_dict, chain_id)
|
tx_data_dict = _normalize_transaction_data(tx_data_dict, chain_id)
|
||||||
_validate_transaction_admission(tx_data_dict, mempool)
|
_validate_transaction_admission(tx_data_dict, mempool)
|
||||||
|
|||||||
Reference in New Issue
Block a user