mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-23 20:45:51 +00:00
Be more strict with payment build_path flag.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user