mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove obsolete code
This commit is contained in:
@@ -394,86 +394,6 @@ parseAccountIds(Json::Value const& jvArray)
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
addPaymentDeliveredAmount(Json::Value& meta, RPC::Context& context,
|
||||
std::shared_ptr<Transaction> transaction, TxMeta::pointer transactionMeta)
|
||||
{
|
||||
// We only want to add a "delivered_amount" field if the transaction
|
||||
// succeeded - otherwise nothing could have been delivered.
|
||||
if (! transaction)
|
||||
return;
|
||||
|
||||
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)
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (serializedTx->isFieldPresent (sfAmount))
|
||||
{
|
||||
// Ledger 4594095 is the first ledger in which the DeliveredAmount field
|
||||
// was present when a partial payment was made and its absence indicates
|
||||
// that the amount delivered is listed in the Amount field.
|
||||
if (transaction->getLedger () >= 4594095)
|
||||
{
|
||||
meta[jss::delivered_amount] =
|
||||
serializedTx->getFieldAmount (sfAmount).getJson (1);
|
||||
return;
|
||||
}
|
||||
|
||||
// If the ledger closed long after the DeliveredAmount code was deployed
|
||||
// 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 const ct =
|
||||
context.ledgerMaster.getCloseTimeBySeq (transaction->getLedger ());
|
||||
if (ct && (*ct > NetClock::time_point{446000000s}))
|
||||
{
|
||||
// 446000000 is 2014-02-18 00:53:20 UTC, well after DeliveredAmount went live
|
||||
meta[jss::delivered_amount] =
|
||||
serializedTx->getFieldAmount (sfAmount).getJson (1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise we report "unavailable" which cannot be parsed into a
|
||||
// sensible amount.
|
||||
meta[jss::delivered_amount] = Json::Value ("unavailable");
|
||||
}
|
||||
|
||||
void
|
||||
injectSLE(Json::Value& jv, SLE const& sle)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user