mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-04 19:25:51 +00:00
Eliminate need for ledger in delivered_amount calculation (RIPD-860)
This commit is contained in:
@@ -17,9 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "boost/date_time/posix_time/posix_time.hpp"
|
||||
#include <utility>
|
||||
|
||||
namespace ripple {
|
||||
namespace RPC {
|
||||
|
||||
@@ -49,21 +46,15 @@ addPaymentDeliveredAmount (
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto ledger = context.netOps.getLedgerBySeq (transaction->getLedger ()))
|
||||
{
|
||||
// If the ledger closed at 2014-Jan-24 at 04:50:10 or later, then
|
||||
// the absence of the DeliveredAmount field indicates that the
|
||||
// actual amount delivered is in the Amount field.
|
||||
boost::posix_time::ptime const cutoff (
|
||||
boost::posix_time::time_from_string ("2014-01-24 04:50:10"));
|
||||
|
||||
if (ledger->getCloseTime () >= cutoff)
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise we report "unavailable" which cannot be parsed into a
|
||||
// sensible amount.
|
||||
|
||||
Reference in New Issue
Block a user