diff --git a/src/ripple/rpc/impl/Utilities.cpp b/src/ripple/rpc/impl/Utilities.cpp index 3966199bd..1b651809c 100644 --- a/src/ripple/rpc/impl/Utilities.cpp +++ b/src/ripple/rpc/impl/Utilities.cpp @@ -18,6 +18,7 @@ //============================================================================== #include +#include #include #include #include @@ -65,6 +66,19 @@ addPaymentDeliveredAmount ( 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. + auto ct = + context.ledgerMaster.getCloseTimeBySeq (transaction->getLedger ()); + if (ct && (*ct > 446000000)) + { + // 446000000 is in Feb 2014, 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");