get_alt_blocks modified

master
moneroexamples 7 years ago
parent ba6f5b81f0
commit 90638a25ac

@ -425,15 +425,15 @@ namespace xmreg
{"show_cache_times" , show_cache_times} {"show_cache_times" , show_cache_times}
}; };
vector<block_complete_entry> atl_blks; vector<string> atl_blks_hashes;
rpc.get_alt_blocks(atl_blks); rpc.get_alt_blocks(atl_blks_hashes);
cout << "atl_blks.size(): " << atl_blks.size() << endl; cout << "atl_blks_hashes.size(): " << atl_blks_hashes.size() << endl;
for (const block_complete_entry& alt_blk: atl_blks) for (const string& alt_blk_hash: atl_blks_hashes)
{ {
cout << "alt_blk tx: " << alt_blk.txs.size() << endl; cout << "alt_blk_hash: " << alt_blk_hash << endl;
} }
context.emplace("txs", mstch::array()); // will keep tx to show context.emplace("txs", mstch::array()); // will keep tx to show

@ -209,12 +209,12 @@ rpccalls::get_network_info(COMMAND_RPC_GET_INFO::response& response)
} }
bool bool
rpccalls::get_alt_blocks(vector<block_complete_entry>& alt_blocks) rpccalls::get_alt_blocks(vector<string>& alt_blocks_hashes)
{ {
bool r {false}; bool r {false};
COMMAND_RPC_GET_ALT_BLOCKS::request req; COMMAND_RPC_GET_ALT_BLOCKS_HASHES::request req;
COMMAND_RPC_GET_ALT_BLOCKS::response resp; COMMAND_RPC_GET_ALT_BLOCKS_HASHES::response resp;
{ {
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex); std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
@ -225,7 +225,7 @@ rpccalls::get_alt_blocks(vector<block_complete_entry>& alt_blocks)
return false; return false;
} }
r = epee::net_utils::invoke_http_bin("/getaltblocks.bin", r = epee::net_utils::invoke_http_json("/get_alt_blocks_hashes",
req, resp, req, resp,
m_http_client); m_http_client);
} }
@ -257,7 +257,7 @@ rpccalls::get_alt_blocks(vector<block_complete_entry>& alt_blocks)
return false; return false;
} }
alt_blocks = resp.blocks; alt_blocks_hashes = resp.blks_hashes;
return true; return true;
} }

@ -53,7 +53,7 @@ public:
get_network_info(COMMAND_RPC_GET_INFO::response& info); get_network_info(COMMAND_RPC_GET_INFO::response& info);
bool bool
get_alt_blocks(vector<block_complete_entry>& alt_blocks); get_alt_blocks(vector<string>& alt_blocks_hashes);
bool bool
get_dynamic_per_kb_fee_estimate( get_dynamic_per_kb_fee_estimate(

Loading…
Cancel
Save