Commit e76ca883 authored by Pierre Kim's avatar Pierre Kim

Add KRB-compatible f_pool_json command

parent 62366f21
......@@ -151,7 +151,7 @@ struct F_COMMAND_RPC_GET_TRANSACTION_DETAILS {
};
};
struct F_COMMAND_RPC_GET_POOL {
struct F_COMMAND_RPC_GET_TRANSACTIONS_POOL {
typedef EMPTY_STRUCT request;
struct response {
......@@ -165,6 +165,20 @@ struct F_COMMAND_RPC_GET_POOL {
};
};
struct F_COMMAND_RPC_GET_POOL {
typedef std::vector<std::string> request;
struct response {
std::string transactions;
std::string status;
void serialize(ISerializer &s) {
KV_MEMBER(transactions)
KV_MEMBER(status)
}
};
};
struct currency_base_coin {
std::string name;
std::string git;
......
......@@ -137,6 +137,7 @@ bool RpcServer::processJsonRpcRequest(const HttpRequest& request, HttpResponse&
{ "f_blocks_list_json",{ makeMemberMethod(&RpcServer::f_on_blocks_list_json), false } },
{ "f_block_json",{ makeMemberMethod(&RpcServer::f_on_block_json), false } },
{ "f_transaction_json",{ makeMemberMethod(&RpcServer::f_on_transaction_json), false } },
{ "f_pool_json",{ makeMemberMethod(&RpcServer::f_on_pool_json), false } },
{ "f_transactions_pool_json",{ makeMemberMethod(&RpcServer::f_on_transactions_pool_json), false } },
{ "getblockcount", { makeMemberMethod(&RpcServer::on_getblockcount), true } },
{ "on_getblockhash", { makeMemberMethod(&RpcServer::on_getblockhash), false } },
......@@ -879,7 +880,7 @@ bool RpcServer::f_on_transaction_json(const F_COMMAND_RPC_GET_TRANSACTION_DETAIL
return true;
}
bool RpcServer::f_on_transactions_pool_json(const F_COMMAND_RPC_GET_POOL::request& req, F_COMMAND_RPC_GET_POOL::response& res) {
bool RpcServer::f_on_transactions_pool_json(const F_COMMAND_RPC_GET_TRANSACTIONS_POOL::request& req, F_COMMAND_RPC_GET_TRANSACTIONS_POOL::response& res) {
auto pool = m_core.getPoolTransactions();
for (const Transaction tx : pool) {
f_transaction_short_response transaction_short;
......@@ -897,6 +898,14 @@ bool RpcServer::f_on_transactions_pool_json(const F_COMMAND_RPC_GET_POOL::reques
return true;
}
bool RpcServer::f_on_pool_json(const F_COMMAND_RPC_GET_POOL::request& req, F_COMMAND_RPC_GET_POOL::response& res) {
res.transactions = m_core.print_pool(true);
res.status = CORE_RPC_STATUS_OK;
return true;
}
bool RpcServer::enableCors(const std::vector<std::string> domains) {
m_cors_domains = domains;
return true;
......
......@@ -69,7 +69,8 @@ private:
bool f_on_blocks_list_json(const COMMAND_RPC_BLOCKS_LIST_JSON::request& req, COMMAND_RPC_BLOCKS_LIST_JSON::response& res);
bool f_on_block_json(const F_COMMAND_RPC_GET_BLOCK_DETAILS::request& req, F_COMMAND_RPC_GET_BLOCK_DETAILS::response& res);
bool f_on_transaction_json(const F_COMMAND_RPC_GET_TRANSACTION_DETAILS::request& req, F_COMMAND_RPC_GET_TRANSACTION_DETAILS::response& res);
bool f_on_transactions_pool_json(const F_COMMAND_RPC_GET_POOL::request& req, F_COMMAND_RPC_GET_POOL::response& res);
bool f_on_transactions_pool_json(const F_COMMAND_RPC_GET_TRANSACTIONS_POOL::request& req, F_COMMAND_RPC_GET_TRANSACTIONS_POOL::response& res);
bool f_on_pool_json(const F_COMMAND_RPC_GET_POOL::request& req, F_COMMAND_RPC_GET_POOL::response& res);
void fill_block_header_response(const Block& blk, bool orphan_status, uint64_t height, const Crypto::Hash& hash, block_header_response& responce);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment