From e239eed6de4e9f557558b0eb8933e5bb6872b24f Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Mon, 18 Mar 2019 16:18:42 -0700 Subject: [PATCH] Remove obsolete code --- src/ripple/rpc/impl/RPCHelpers.cpp | 80 ------------------------------ 1 file changed, 80 deletions(-) diff --git a/src/ripple/rpc/impl/RPCHelpers.cpp b/src/ripple/rpc/impl/RPCHelpers.cpp index 79c45fdc9..3162ffc7d 100644 --- a/src/ripple/rpc/impl/RPCHelpers.cpp +++ b/src/ripple/rpc/impl/RPCHelpers.cpp @@ -394,86 +394,6 @@ parseAccountIds(Json::Value const& jvArray) return result; } -void -addPaymentDeliveredAmount(Json::Value& meta, RPC::Context& context, - std::shared_ptr 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) {