mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Improved reporting for delivered_amount:
* Determine tx success from metadata result. * Report delivered_amount for legacy account_tx queries.
This commit is contained in:
committed by
Vinnie Falco
parent
1e92ac3cf5
commit
fbf736f169
@@ -42,20 +42,29 @@ addPaymentDeliveredAmount (
|
||||
{
|
||||
// We only want to add a "delivered_amount" field if the transaction
|
||||
// succeeded - otherwise nothing could have been delivered.
|
||||
if (!transaction || transaction->getResult () != tesSUCCESS)
|
||||
if (! transaction)
|
||||
return;
|
||||
|
||||
auto serializedTx = transaction->getSTransaction ();
|
||||
|
||||
if (!serializedTx || serializedTx->getTxnType () != ttPAYMENT)
|
||||
if (! serializedTx || serializedTx->getTxnType () != ttPAYMENT)
|
||||
return;
|
||||
|
||||
// If the transaction explicitly specifies a DeliveredAmount in the
|
||||
// metadata then we use it.
|
||||
if (transactionMeta && transactionMeta->hasDeliveredAmount ())
|
||||
if (transactionMeta)
|
||||
{
|
||||
if (transactionMeta->getResultTER() != tesSUCCESS)
|
||||
return;
|
||||
|
||||
// If the transaction explicitly specifies a DeliveredAmount in the
|
||||
// metadata then we use it.
|
||||
if (transactionMeta->hasDeliveredAmount ())
|
||||
{
|
||||
meta[jss::delivered_amount] =
|
||||
transactionMeta->getDeliveredAmount ().getJson (1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (transaction->getResult() != tesSUCCESS)
|
||||
{
|
||||
meta[jss::delivered_amount] =
|
||||
transactionMeta->getDeliveredAmount ().getJson (1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user