mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add delivered_amount to tx result for CheckCash (RIPD-1623)
This commit is contained in:
committed by
Nikolaos D. Bougalis
parent
6bd0b850a0
commit
7bc163ee4c
@@ -18,10 +18,12 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <ripple/app/ledger/OpenLedger.h>
|
||||
#include <ripple/app/misc/Transaction.h>
|
||||
#include <ripple/ledger/View.h>
|
||||
#include <ripple/net/RPCErr.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/Feature.h>
|
||||
#include <ripple/rpc/Context.h>
|
||||
#include <ripple/rpc/impl/RPCHelpers.h>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
@@ -400,10 +402,26 @@ addPaymentDeliveredAmount(Json::Value& meta, RPC::Context& context,
|
||||
if (! transaction)
|
||||
return;
|
||||
|
||||
auto serializedTx = transaction->getSTransaction ();
|
||||
if (! serializedTx || serializedTx->getTxnType () != ttPAYMENT)
|
||||
auto const serializedTx = transaction->getSTransaction ();
|
||||
if (! serializedTx)
|
||||
return;
|
||||
|
||||
{
|
||||
// Only include this field for Payment and CheckCash transactions.
|
||||
TxType const tt {serializedTx->getTxnType()};
|
||||
if ((tt != ttPAYMENT) && (tt != ttCHECK_CASH))
|
||||
return;
|
||||
|
||||
// Only include this field for CheckCash transactions if the fix
|
||||
// is enabled.
|
||||
if (tt == ttCHECK_CASH)
|
||||
{
|
||||
auto const view = context.app.openLedger().current();
|
||||
if (!view || !view->rules().enabled (fix1623))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (transactionMeta)
|
||||
{
|
||||
if (transactionMeta->getResultTER() != tesSUCCESS)
|
||||
@@ -437,7 +455,7 @@ addPaymentDeliveredAmount(Json::Value& meta, RPC::Context& context,
|
||||
// then its absence indicates that the amount delivered is listed in the
|
||||
// Amount field. DeliveredAmount went live January 24, 2014.
|
||||
using namespace std::chrono_literals;
|
||||
auto ct =
|
||||
auto const ct =
|
||||
context.ledgerMaster.getCloseTimeBySeq (transaction->getLedger ());
|
||||
if (ct && (*ct > NetClock::time_point{446000000s}))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user