mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-24 13:05:53 +00:00
Improve RPC random.
This commit is contained in:
@@ -47,6 +47,7 @@ Json::Value rpcError(int iError, Json::Value jvResult)
|
|||||||
{ rpcNO_PATH, "noPath", "Unable to find a ripple path." },
|
{ rpcNO_PATH, "noPath", "Unable to find a ripple path." },
|
||||||
{ rpcNO_PERMISSION, "noPermission", "You don't have permission for this command." },
|
{ rpcNO_PERMISSION, "noPermission", "You don't have permission for this command." },
|
||||||
{ rpcNOT_STANDALONE, "notStandAlone", "Operation valid in debug mode only." },
|
{ rpcNOT_STANDALONE, "notStandAlone", "Operation valid in debug mode only." },
|
||||||
|
{ rpcNOT_SUPPORTED, "notSupported", "Operation not supported." },
|
||||||
{ rpcPASSWD_CHANGED, "passwdChanged", "Wrong key, password changed." },
|
{ rpcPASSWD_CHANGED, "passwdChanged", "Wrong key, password changed." },
|
||||||
{ rpcPAYS_ACT_MALFORMED, "paysActMalformed", "Pays account malformed." },
|
{ rpcPAYS_ACT_MALFORMED, "paysActMalformed", "Pays account malformed." },
|
||||||
{ rpcPAYS_AMT_MALFORMED, "paysAmtMalformed", "Pays amount malformed." },
|
{ rpcPAYS_AMT_MALFORMED, "paysAmtMalformed", "Pays amount malformed." },
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ enum {
|
|||||||
rpcINTERNAL, // Generic internal error.
|
rpcINTERNAL, // Generic internal error.
|
||||||
rpcFAIL_GEN_DECRPYT,
|
rpcFAIL_GEN_DECRPYT,
|
||||||
rpcNOT_IMPL,
|
rpcNOT_IMPL,
|
||||||
|
rpcNOT_SUPPORTED,
|
||||||
rpcNO_GEN_DECRPYT,
|
rpcNO_GEN_DECRPYT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -697,14 +697,26 @@ Json::Value RPCHandler::doRandom(Json::Value jvRequest)
|
|||||||
{
|
{
|
||||||
uint160 uRandom;
|
uint160 uRandom;
|
||||||
|
|
||||||
RAND_bytes(uRandom.begin(), uRandom.size());
|
switch (RAND_pseudo_bytes(uRandom.begin(), uRandom.size()))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
|
|
||||||
jvResult["random"] = uRandom.ToString();
|
jvResult["random"] = uRandom.ToString();
|
||||||
|
|
||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case -1:
|
||||||
|
return rpcError(rpcNOT_SUPPORTED);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return rpcError(rpcINTERNAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - Add support for specifying non-endpoint issuer.
|
// - Add support for specifying non-endpoint issuer.
|
||||||
|
|||||||
Reference in New Issue
Block a user