1
0
Fork 0
forked from lthn/blockchain

fixed new api for get block direct

This commit is contained in:
cryptozoidberg 2020-05-06 22:43:40 +02:00
parent 62106ff4f3
commit dc1b1d5cfe
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 5 additions and 4 deletions

View file

@ -3025,11 +3025,11 @@ bool blockchain_storage::get_est_height_from_date(uint64_t date, uint64_t& res_h
return true;
}
//------------------------------------------------------------------
bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count)const
bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count, uint64_t minimum_height)const
{
CRITICAL_REGION_LOCAL(m_read_lock);
blocks_direct_container blocks_direct;
if (!find_blockchain_supplement(qblock_ids, blocks_direct, total_height, start_height, max_count))
if (!find_blockchain_supplement(qblock_ids, blocks_direct, total_height, start_height, max_count, minimum_height))
return false;
for (auto& bd : blocks_direct)

View file

@ -254,7 +254,7 @@ namespace currency
bool get_short_chain_history(std::list<crypto::hash>& ids)const;
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, NOTIFY_RESPONSE_CHAIN_ENTRY::request& resp)const;
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, uint64_t& starter_offset)const;
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count)const;
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count, uint64_t minimum_height = 0)const;
bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, blocks_direct_container& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count, uint64_t minimum_height = 0)const;
//bool find_blockchain_supplement(const std::list<crypto::hash>& qblock_ids, std::list<std::pair<block, std::list<transaction> > >& blocks, uint64_t& total_height, uint64_t& start_height, size_t max_count)const;
bool handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NOTIFY_RESPONSE_GET_OBJECTS::request& rsp)const;

View file

@ -301,7 +301,7 @@ namespace currency
}
std::list<std::pair<block, std::list<transaction> > > bs;
if(!m_core.find_blockchain_supplement(req.block_ids, bs, res.current_height, res.start_height, COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT))
if(!m_core.get_blockchain_storage().find_blockchain_supplement(req.block_ids, bs, res.current_height, res.start_height, COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT, req.minimum_height))
{
res.status = CORE_RPC_STATUS_FAILED;
return false;

View file

@ -38,6 +38,7 @@ namespace tools
{
currency::COMMAND_RPC_GET_BLOCKS_FAST::request req;
req.block_ids = rqt.block_ids;
req.minimum_height = rqt.minimum_height;
currency::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
bool r = call_COMMAND_RPC_GET_BLOCKS_FAST(req, res);
rsp.status = res.status;