Remove obsolete code

This commit is contained in:
Nik Bougalis
2019-03-18 16:18:42 -07:00
parent 504b3441dd
commit e239eed6de

View File

@@ -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)
{