merge from release2

This commit is contained in:
cryptozoidberg 2024-03-24 15:56:58 +01:00
commit 721b027000
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
8 changed files with 12 additions and 25 deletions

View file

@ -3595,7 +3595,7 @@ 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, uint64_t minimum_height, bool need_global_indexes)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;
@ -3614,7 +3614,7 @@ bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash
return true;
}
//------------------------------------------------------------------
bool blockchain_storage::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, bool request_coinbase_info)const
bool blockchain_storage::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)const
{
CRITICAL_REGION_LOCAL(m_read_lock);
if (!find_blockchain_supplement(qblock_ids, start_height))
@ -3631,8 +3631,7 @@ bool blockchain_storage::find_blockchain_supplement(const std::list<crypto::hash
std::list<crypto::hash> mis;
get_transactions_direct(m_db_blocks[i]->bl.tx_hashes, blocks.back().second, mis);
CHECK_AND_ASSERT_MES(!mis.size(), false, "internal error, block " << get_block_hash(m_db_blocks[i]->bl) << " [" << i << "] contains missing transactions: " << mis);
if(request_coinbase_info)
blocks.back().third = m_db_transactions.find(get_transaction_hash(m_db_blocks[i]->bl.miner_tx));
blocks.back().third = m_db_transactions.find(get_transaction_hash(m_db_blocks[i]->bl.miner_tx));
}
return true;
}

View file

@ -280,8 +280,8 @@ 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, uint64_t minimum_height = 0, bool need_global_indexes = false)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, bool request_coinbase_info = false)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;
bool handle_get_objects(const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::request& req, COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response& res)const;

View file

@ -289,7 +289,7 @@ namespace currency
}
blockchain_storage::blocks_direct_container bs;
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, req.need_global_indexes))
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 = API_RETURN_CODE_FAIL;
return false;
@ -326,7 +326,7 @@ namespace currency
}
blockchain_storage::blocks_direct_container bs;
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, req.need_global_indexes))
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 = API_RETURN_CODE_FAIL;
return false;
@ -336,21 +336,15 @@ namespace currency
{
res.blocks.resize(res.blocks.size()+1);
res.blocks.back().block = block_to_blob(b.first->bl);
if (req.need_global_indexes)
{
CHECK_AND_ASSERT_MES(b.third.get(), false, "Internal error on handling COMMAND_RPC_GET_BLOCKS_FAST: b.third is empty, ie coinbase info is not prepared");
res.blocks.back().coinbase_global_outs = b.third->m_global_output_indexes;
res.blocks.back().tx_global_outs.resize(b.second.size());
}
CHECK_AND_ASSERT_MES(b.third.get(), false, "Internal error on handling COMMAND_RPC_GET_BLOCKS_FAST: b.third is empty, ie coinbase info is not prepared");
res.blocks.back().coinbase_global_outs = b.third->m_global_output_indexes;
res.blocks.back().tx_global_outs.resize(b.second.size());
size_t i = 0;
BOOST_FOREACH(auto& t, b.second)
{
res.blocks.back().txs.push_back(tx_to_blob(t->tx));
if (req.need_global_indexes)
{
res.blocks.back().tx_global_outs[i].v = t->m_global_output_indexes;
}
res.blocks.back().tx_global_outs[i].v = t->m_global_output_indexes;
i++;
}
}

View file

@ -161,12 +161,10 @@ namespace currency
struct request
{
bool need_global_indexes;
uint64_t minimum_height;
std::list<crypto::hash> block_ids; //*first 10 blocks id goes sequential, next goes in pow(2,n) offset, like 2, 4, 8, 16, 32, 64 and so on, and the last one is always genesis block */
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(need_global_indexes)
KV_SERIALIZE(minimum_height)
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(block_ids)
END_KV_SERIALIZE_MAP()

View file

@ -39,7 +39,6 @@ namespace tools
currency::COMMAND_RPC_GET_BLOCKS_FAST::request req;
req.block_ids = rqt.block_ids;
req.minimum_height = rqt.minimum_height;
req.need_global_indexes = rqt.need_global_indexes;
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;

View file

@ -1897,8 +1897,6 @@ void wallet2::pull_blocks(size_t& blocks_added, std::atomic<bool>& stop)
currency::COMMAND_RPC_GET_BLOCKS_DIRECT::response res = AUTO_VAL_INIT(res);
req.minimum_height = get_wallet_minimum_height();
if (is_auditable())
req.need_global_indexes = true;
if (req.minimum_height > m_height_of_start_sync)
m_height_of_start_sync = req.minimum_height;

View file

@ -48,7 +48,7 @@
#define TX_POOL_SCAN_INTERVAL 1
#endif
#define HTTP_PROXY_TIMEOUT 2000
#define HTTP_PROXY_TIMEOUT 4000
#define HTTP_PROXY_ATTEMPTS_COUNT 1
const command_line::arg_descriptor<bool> arg_alloc_win_console ( "alloc-win-console", "Allocates debug console with GUI", false );

View file

@ -112,7 +112,6 @@ bool wallet_test_core_proxy::call_COMMAND_RPC_GET_BLOCKS_DIRECT(const currency::
currency::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
req.block_ids = rqt.block_ids;
req.minimum_height = rqt.minimum_height;
req.need_global_indexes = rqt.need_global_indexes;
currency::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
bool r = this->call_COMMAND_RPC_GET_BLOCKS_FAST(req, res);
rsp.status = res.status;