From af29f41dfaefc166263b62ce4f4c434a9b0f0e26 Mon Sep 17 00:00:00 2001 From: Shawn Xie Date: Tue, 15 Oct 2024 09:59:49 -0400 Subject: [PATCH] use mptJson --- src/xrpld/rpc/handlers/LedgerEntry.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/xrpld/rpc/handlers/LedgerEntry.cpp b/src/xrpld/rpc/handlers/LedgerEntry.cpp index 30b1113cd05..b8937c528eb 100644 --- a/src/xrpld/rpc/handlers/LedgerEntry.cpp +++ b/src/xrpld/rpc/handlers/LedgerEntry.cpp @@ -668,18 +668,18 @@ doLedgerEntry(RPC::JsonContext& context) else if (context.params.isMember(jss::mptoken)) { expectedType = ltMPTOKEN; - if (!context.params[jss::mptoken].isObject()) + auto const& mptJson = context.params[jss::mptoken]; + if (!mptJson.isObject()) { - if (!uNodeIndex.parseHex( - context.params[jss::mptoken].asString())) + if (!uNodeIndex.parseHex(mptJson.asString())) { uNodeIndex = beast::zero; jvResult[jss::error] = "malformedRequest"; } } else if ( - !context.params[jss::mptoken].isMember(jss::mpt_issuance_id) || - !context.params[jss::mptoken].isMember(jss::account)) + !mptJson.isMember(jss::mpt_issuance_id) || + !mptJson.isMember(jss::account)) { jvResult[jss::error] = "malformedRequest"; } @@ -688,8 +688,7 @@ doLedgerEntry(RPC::JsonContext& context) try { auto const mptIssuanceIdStr = - context.params[jss::mptoken][jss::mpt_issuance_id] - .asString(); + mptJson[jss::mpt_issuance_id].asString(); uint192 mptIssuanceID; if (!mptIssuanceID.parseHex(mptIssuanceIdStr)) @@ -697,7 +696,7 @@ doLedgerEntry(RPC::JsonContext& context) "Cannot parse mpt_issuance_id"); auto const account = parseBase58( - context.params[jss::mptoken][jss::account].asString()); + mptJson[jss::account].asString()); if (!account || account->isZero()) jvResult[jss::error] = "malformedAddress";