mirror of
https://github.com/monero-project/monero.git
synced 2026-08-02 08:58:06 -07:00
Add a get_outs (fully text based) version of get_outs.bin
This commit is contained in:
@@ -246,7 +246,7 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res)
|
||||
bool core_rpc_server::on_get_outs_bin(const COMMAND_RPC_GET_OUTPUTS_BIN::request& req, COMMAND_RPC_GET_OUTPUTS_BIN::response& res)
|
||||
{
|
||||
CHECK_CORE_BUSY();
|
||||
res.status = "Failed";
|
||||
@@ -269,6 +269,42 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res)
|
||||
{
|
||||
CHECK_CORE_BUSY();
|
||||
res.status = "Failed";
|
||||
|
||||
if (m_restricted)
|
||||
{
|
||||
if (req.outputs.size() > MAX_RESTRICTED_GLOBAL_FAKE_OUTS_COUNT)
|
||||
{
|
||||
res.status = "Too many outs requested";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
cryptonote::COMMAND_RPC_GET_OUTPUTS_BIN::request req_bin;
|
||||
req_bin.outputs = req.outputs;
|
||||
cryptonote::COMMAND_RPC_GET_OUTPUTS_BIN::response res_bin;
|
||||
if(!m_core.get_outs(req_bin, res_bin))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// convert to text
|
||||
for (const auto &i: res_bin.outs)
|
||||
{
|
||||
res.outs.push_back(cryptonote::COMMAND_RPC_GET_OUTPUTS::outkey());
|
||||
cryptonote::COMMAND_RPC_GET_OUTPUTS::outkey &outkey = res.outs.back();
|
||||
outkey.key = epee::string_tools::pod_to_hex(i.key);
|
||||
outkey.mask = epee::string_tools::pod_to_hex(i.mask);
|
||||
outkey.unlocked = i.unlocked;
|
||||
}
|
||||
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_get_random_rct_outs(const COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::request& req, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::response& res)
|
||||
{
|
||||
CHECK_CORE_BUSY();
|
||||
|
||||
Reference in New Issue
Block a user