aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp71
-rw-r--r--src/rpc/core_rpc_server.h6
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h77
-rw-r--r--src/rpc/daemon_handler.cpp39
-rw-r--r--src/rpc/daemon_handler.h2
-rw-r--r--src/rpc/daemon_messages.cpp37
6 files changed, 0 insertions, 232 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 4383ad190..db7f2dbaa 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -364,49 +364,6 @@ namespace cryptonote
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
- bool core_rpc_server::on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)
- {
- PERF_TIMER(on_get_random_outs);
- bool r;
- if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS>(invoke_http_mode::BIN, "/getrandom_outs.bin", req, res, r))
- return r;
-
- res.status = "Failed";
-
- if (m_restricted)
- {
- if (req.amounts.size() > 100 || req.outs_count > MAX_RESTRICTED_FAKE_OUTS_COUNT)
- {
- res.status = "Too many outs requested";
- return true;
- }
- }
-
- if(!m_core.get_random_outs_for_amounts(req, res))
- {
- return true;
- }
-
- res.status = CORE_RPC_STATUS_OK;
- std::stringstream ss;
- typedef COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount outs_for_amount;
- typedef COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry out_entry;
- std::for_each(res.outs.begin(), res.outs.end(), [&](outs_for_amount& ofa)
- {
- ss << "[" << ofa.amount << "]:";
- CHECK_AND_ASSERT_MES(ofa.outs.size(), ;, "internal error: ofa.outs.size() is empty for amount " << ofa.amount);
- std::for_each(ofa.outs.begin(), ofa.outs.end(), [&](out_entry& oe)
- {
- ss << oe.global_amount_index << " ";
- });
- ss << ENDL;
- });
- std::string s = ss.str();
- LOG_PRINT_L2("COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS: " << ENDL << s);
- res.status = CORE_RPC_STATUS_OK;
- return true;
- }
- //------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_get_outs_bin(const COMMAND_RPC_GET_OUTPUTS_BIN::request& req, COMMAND_RPC_GET_OUTPUTS_BIN::response& res)
{
PERF_TIMER(on_get_outs_bin);
@@ -476,34 +433,6 @@ namespace cryptonote
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)
- {
- PERF_TIMER(on_get_random_rct_outs);
- bool r;
- if (use_bootstrap_daemon_if_necessary<COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS>(invoke_http_mode::BIN, "/getrandom_rctouts.bin", req, res, r))
- return r;
-
- res.status = "Failed";
- if(!m_core.get_random_rct_outs(req, res))
- {
- return true;
- }
-
- res.status = CORE_RPC_STATUS_OK;
- std::stringstream ss;
- typedef COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::out_entry out_entry;
- CHECK_AND_ASSERT_MES(res.outs.size(), true, "internal error: res.outs.size() is empty");
- std::for_each(res.outs.begin(), res.outs.end(), [&](out_entry& oe)
- {
- ss << oe.global_amount_index << " ";
- });
- ss << ENDL;
- std::string s = ss.str();
- LOG_PRINT_L2("COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS: " << ENDL << s);
- res.status = CORE_RPC_STATUS_OK;
- return true;
- }
- //------------------------------------------------------------------------------------------------------------------------------
bool core_rpc_server::on_get_indexes(const COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::request& req, COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES::response& res)
{
PERF_TIMER(on_get_indexes);
diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h
index 5dbe44d24..3ba882b23 100644
--- a/src/rpc/core_rpc_server.h
+++ b/src/rpc/core_rpc_server.h
@@ -87,11 +87,7 @@ namespace cryptonote
MAP_URI_AUTO_BIN2("/get_hashes.bin", on_get_hashes, COMMAND_RPC_GET_HASHES_FAST)
MAP_URI_AUTO_BIN2("/gethashes.bin", on_get_hashes, COMMAND_RPC_GET_HASHES_FAST)
MAP_URI_AUTO_BIN2("/get_o_indexes.bin", on_get_indexes, COMMAND_RPC_GET_TX_GLOBAL_OUTPUTS_INDEXES)
- MAP_URI_AUTO_BIN2("/get_random_outs.bin", on_get_random_outs, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS)
- MAP_URI_AUTO_BIN2("/getrandom_outs.bin", on_get_random_outs, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS)
MAP_URI_AUTO_BIN2("/get_outs.bin", on_get_outs_bin, COMMAND_RPC_GET_OUTPUTS_BIN)
- MAP_URI_AUTO_BIN2("/get_random_rctouts.bin", on_get_random_rct_outs, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS)
- MAP_URI_AUTO_BIN2("/getrandom_rctouts.bin", on_get_random_rct_outs, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS)
MAP_URI_AUTO_JON2("/get_transactions", on_get_transactions, COMMAND_RPC_GET_TRANSACTIONS)
MAP_URI_AUTO_JON2("/gettransactions", on_get_transactions, COMMAND_RPC_GET_TRANSACTIONS)
MAP_URI_AUTO_JON2("/get_alt_blocks_hashes", on_get_alt_blocks_hashes, COMMAND_RPC_GET_ALT_BLOCKS_HASHES)
@@ -171,10 +167,8 @@ namespace cryptonote
bool on_start_mining(const COMMAND_RPC_START_MINING::request& req, COMMAND_RPC_START_MINING::response& res);
bool on_stop_mining(const COMMAND_RPC_STOP_MINING::request& req, COMMAND_RPC_STOP_MINING::response& res);
bool on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res);
- bool on_get_random_outs(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res);
bool on_get_outs_bin(const COMMAND_RPC_GET_OUTPUTS_BIN::request& req, COMMAND_RPC_GET_OUTPUTS_BIN::response& res);
bool on_get_outs(const COMMAND_RPC_GET_OUTPUTS::request& req, COMMAND_RPC_GET_OUTPUTS::response& res);
- bool on_get_random_rct_outs(const COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::request& req, COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS::response& res);
bool on_get_info(const COMMAND_RPC_GET_INFO::request& req, COMMAND_RPC_GET_INFO::response& res);
bool on_save_bc(const COMMAND_RPC_SAVE_BC::request& req, COMMAND_RPC_SAVE_BC::response& res);
bool on_get_peer_list(const COMMAND_RPC_GET_PEER_LIST::request& req, COMMAND_RPC_GET_PEER_LIST::response& res);
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index da4c8b6cf..1a84ee614 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -680,50 +680,6 @@ namespace cryptonote
};
};
//-----------------------------------------------
- struct COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS
- {
- struct request
- {
- std::vector<uint64_t> amounts;
- uint64_t outs_count;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amounts)
- KV_SERIALIZE(outs_count)
- END_KV_SERIALIZE_MAP()
- };
-
-#pragma pack (push, 1)
- struct out_entry
- {
- uint64_t global_amount_index;
- crypto::public_key out_key;
- };
-#pragma pack(pop)
-
- struct outs_for_amount
- {
- uint64_t amount;
- std::list<out_entry> outs;
-
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(amount)
- KV_SERIALIZE_CONTAINER_POD_AS_BLOB(outs)
- END_KV_SERIALIZE_MAP()
- };
-
- struct response
- {
- std::vector<outs_for_amount> outs;
- std::string status;
- bool untrusted;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(outs)
- KV_SERIALIZE(status)
- KV_SERIALIZE(untrusted)
- END_KV_SERIALIZE_MAP()
- };
- };
- //-----------------------------------------------
struct get_outputs_out
{
uint64_t amount;
@@ -818,39 +774,6 @@ namespace cryptonote
END_KV_SERIALIZE_MAP()
};
};
-
- struct COMMAND_RPC_GET_RANDOM_RCT_OUTPUTS
- {
- struct request
- {
- uint64_t outs_count;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE(outs_count)
- END_KV_SERIALIZE_MAP()
- };
-
-#pragma pack (push, 1)
- struct out_entry
- {
- uint64_t amount;
- uint64_t global_amount_index;
- crypto::public_key out_key;
- rct::key commitment;
- };
-#pragma pack(pop)
-
- struct response
- {
- std::list<out_entry> outs;
- std::string status;
- bool untrusted;
- BEGIN_KV_SERIALIZE_MAP()
- KV_SERIALIZE_CONTAINER_POD_AS_BLOB(outs)
- KV_SERIALIZE(status)
- KV_SERIALIZE(untrusted)
- END_KV_SERIALIZE_MAP()
- };
- };
//-----------------------------------------------
struct COMMAND_RPC_SEND_RAW_TX
{
diff --git a/src/rpc/daemon_handler.cpp b/src/rpc/daemon_handler.cpp
index 26f102a8b..9d3b09b68 100644
--- a/src/rpc/daemon_handler.cpp
+++ b/src/rpc/daemon_handler.cpp
@@ -260,44 +260,6 @@ namespace rpc
}
- //TODO: handle "restricted" RPC
- void DaemonHandler::handle(const GetRandomOutputsForAmounts::Request& req, GetRandomOutputsForAmounts::Response& res)
- {
- auto& chain = m_core.get_blockchain_storage();
-
- try
- {
- for (const uint64_t& amount : req.amounts)
- {
- std::vector<uint64_t> indices = chain.get_random_outputs(amount, req.count);
-
- outputs_for_amount ofa;
-
- ofa.resize(indices.size());
-
- for (size_t i = 0; i < indices.size(); i++)
- {
- crypto::public_key key = chain.get_output_key(amount, indices[i]);
- ofa[i].amount_index = indices[i];
- ofa[i].key = key;
- }
-
- amount_with_random_outputs amt;
- amt.amount = amount;
- amt.outputs = ofa;
-
- res.amounts_with_outputs.push_back(amt);
- }
-
- res.status = Message::STATUS_OK;
- }
- catch (const std::exception& e)
- {
- res.status = Message::STATUS_FAILED;
- res.error_details = e.what();
- }
- }
-
void DaemonHandler::handle(const SendRawTx::Request& req, SendRawTx::Response& res)
{
auto tx_blob = cryptonote::tx_to_blob(req.tx);
@@ -824,7 +786,6 @@ namespace rpc
REQ_RESP_TYPES_MACRO(request_type, GetTransactions, req_json, resp_message, handle);
REQ_RESP_TYPES_MACRO(request_type, KeyImagesSpent, req_json, resp_message, handle);
REQ_RESP_TYPES_MACRO(request_type, GetTxGlobalOutputIndices, req_json, resp_message, handle);
- REQ_RESP_TYPES_MACRO(request_type, GetRandomOutputsForAmounts, req_json, resp_message, handle);
REQ_RESP_TYPES_MACRO(request_type, SendRawTx, req_json, resp_message, handle);
REQ_RESP_TYPES_MACRO(request_type, GetInfo, req_json, resp_message, handle);
REQ_RESP_TYPES_MACRO(request_type, StartMining, req_json, resp_message, handle);
diff --git a/src/rpc/daemon_handler.h b/src/rpc/daemon_handler.h
index f43711640..5f9687511 100644
--- a/src/rpc/daemon_handler.h
+++ b/src/rpc/daemon_handler.h
@@ -66,8 +66,6 @@ class DaemonHandler : public RpcHandler
void handle(const GetTxGlobalOutputIndices::Request& req, GetTxGlobalOutputIndices::Response& res);
- void handle(const GetRandomOutputsForAmounts::Request& req, GetRandomOutputsForAmounts::Response& res);
-
void handle(const SendRawTx::Request& req, SendRawTx::Response& res);
void handle(const StartMining::Request& req, StartMining::Response& res);
diff --git a/src/rpc/daemon_messages.cpp b/src/rpc/daemon_messages.cpp
index e5fb9781c..56f6f6a8c 100644
--- a/src/rpc/daemon_messages.cpp
+++ b/src/rpc/daemon_messages.cpp
@@ -41,7 +41,6 @@ const char* const GetHashesFast::name = "get_hashes_fast";
const char* const GetTransactions::name = "get_transactions";
const char* const KeyImagesSpent::name = "key_images_spent";
const char* const GetTxGlobalOutputIndices::name = "get_tx_global_output_indices";
-const char* const GetRandomOutputsForAmounts::name = "get_random_outputs_for_amounts";
const char* const SendRawTx::name = "send_raw_tx";
const char* const StartMining::name = "start_mining";
const char* const StopMining::name = "stop_mining";
@@ -273,42 +272,6 @@ void GetTxGlobalOutputIndices::Response::fromJson(rapidjson::Value& val)
GET_FROM_JSON_OBJECT(val, output_indices, output_indices);
}
-
-rapidjson::Value GetRandomOutputsForAmounts::Request::toJson(rapidjson::Document& doc) const
-{
- auto val = Message::toJson(doc);
-
- auto& al = doc.GetAllocator();
-
- INSERT_INTO_JSON_OBJECT(val, doc, amounts, amounts);
- INSERT_INTO_JSON_OBJECT(val, doc, count, count);
-
- return val;
-}
-
-void GetRandomOutputsForAmounts::Request::fromJson(rapidjson::Value& val)
-{
- GET_FROM_JSON_OBJECT(val, amounts, amounts);
- GET_FROM_JSON_OBJECT(val, count, count);
-}
-
-rapidjson::Value GetRandomOutputsForAmounts::Response::toJson(rapidjson::Document& doc) const
-{
- auto val = Message::toJson(doc);
-
- auto& al = doc.GetAllocator();
-
- INSERT_INTO_JSON_OBJECT(val, doc, amounts_with_outputs, amounts_with_outputs);
-
- return val;
-}
-
-void GetRandomOutputsForAmounts::Response::fromJson(rapidjson::Value& val)
-{
- GET_FROM_JSON_OBJECT(val, amounts_with_outputs, amounts_with_outputs);
-}
-
-
rapidjson::Value SendRawTx::Request::toJson(rapidjson::Document& doc) const
{
auto val = Message::toJson(doc);