#36 make it compile and work properly

This commit is contained in:
Jakob Lind 2014-08-01 11:29:55 +02:00
parent e4273f2415
commit 29c675acc0

View file

@ -248,19 +248,17 @@ void wallet2::get_short_chain_history(std::list<crypto::hash>& ids)
ids.push_back(m_blockchain[0]);
}
//----------------------------------------------------------------------------------------------------
void wallet2::pull_blocks(size_t& blocks_added)
void wallet2::pull_blocks(uint64_t start_height, size_t& blocks_added)
{
blocks_added = 0;
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
get_short_chain_history(req.block_ids);
req.start_height = start_height;
bool r = net_utils::invoke_http_bin_remote_command2(m_daemon_address + "/getblocks.bin", req, res, m_http_client, WALLET_RCP_CONNECTION_TIMEOUT);
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "getblocks.bin");
THROW_WALLET_EXCEPTION_IF(res.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "getblocks.bin");
THROW_WALLET_EXCEPTION_IF(res.status != CORE_RPC_STATUS_OK, error::get_blocks_error, res.status);
THROW_WALLET_EXCEPTION_IF(m_blockchain.size() <= res.start_height, error::wallet_internal_error,
"wrong daemon response: m_start_height=" + std::to_string(res.start_height) +
" not less than local blockchain size=" + std::to_string(m_blockchain.size()));
size_t current_index = res.start_height;
BOOST_FOREACH(auto& bl_entry, res.blocks)