diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index c633ede404..51c038a037 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -913,7 +913,13 @@ Json::Value RPCHandler::doSubmit(Json::Value jvRequest) txJSON["Fee"] = (int) theConfig.FEE_ACCOUNT_CREATE; } - if (!txJSON.isMember("Paths") && txJSON.isMember("Amount") && jvRequest.isMember("build_path")) + if (txJSON.isMember("Paths") && jvRequest.isMember("build_path")) + { + // Asking to build a path when providing one is an error. + return rpcError(rpcINVALID_PARAMS); + } + + if (!txJSON.isMember("Paths") && txJSON.isMember("Amount") && jvRequest.isMember("build_path")) { // Need a ripple path. STPathSet spsPaths; @@ -939,6 +945,12 @@ Json::Value RPCHandler::doSubmit(Json::Value jvRequest) saSendMax.setIssuer(raSrcAddressID.getAccountID()); } + if (saSendMax.isNative() && saSend.isNative()) + { + // Asking to build a path for XRP to XRP is an error. + return rpcError(rpcINVALID_PARAMS); + } + Pathfinder pf(raSrcAddressID, dstAccountID, saSendMax.getCurrency(), saSendMax.getIssuer(), saSend); if (!pf.findPaths(5, 1, spsPaths))