Be more strict with payment build_path flag.

This commit is contained in:
Arthur Britto
2012-12-07 15:22:24 -08:00
parent 6b39593a13
commit 2701f25052

View File

@@ -913,6 +913,12 @@ Json::Value RPCHandler::doSubmit(Json::Value jvRequest)
txJSON["Fee"] = (int) theConfig.FEE_ACCOUNT_CREATE;
}
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.
@@ -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))