mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Improve RPC random.
This commit is contained in:
@@ -697,13 +697,25 @@ Json::Value RPCHandler::doRandom(Json::Value jvRequest)
|
||||
{
|
||||
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;
|
||||
}
|
||||
break;
|
||||
|
||||
return jvResult;
|
||||
case -1:
|
||||
return rpcError(rpcNOT_SUPPORTED);
|
||||
|
||||
default:
|
||||
return rpcError(rpcINTERNAL);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO:
|
||||
|
||||
Reference in New Issue
Block a user