mirror of
https://github.com/monero-project/monero.git
synced 2025-08-23 11:35:10 -04:00
wallet2: make m_process_pool_txs local to refresh method
This commit is contained in:
parent
f307621678
commit
f383fd3cd0
2 changed files with 11 additions and 12 deletions
|
@ -2742,7 +2742,7 @@ void wallet2::process_pool_info_extent(const cryptonote::COMMAND_RPC_GET_BLOCKS_
|
|||
update_pool_state_from_pool_data(res.pool_info_extent == COMMAND_RPC_GET_BLOCKS_FAST::INCREMENTAL, res.removed_pool_txids, added_pool_txs, process_txs, refreshed);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t ¤t_height)
|
||||
void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, const std::list<crypto::hash> &short_chain_history, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> &o_indices, uint64_t ¤t_height, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>>& process_pool_txs)
|
||||
{
|
||||
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::request req = AUTO_VAL_INIT(req);
|
||||
cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::response res = AUTO_VAL_INIT(res);
|
||||
|
@ -2786,14 +2786,14 @@ void wallet2::pull_blocks(bool first, bool try_incremental, uint64_t start_heigh
|
|||
{
|
||||
if (res.pool_info_extent != COMMAND_RPC_GET_BLOCKS_FAST::NONE)
|
||||
{
|
||||
process_pool_info_extent(res, m_process_pool_txs, true);
|
||||
process_pool_info_extent(res, process_pool_txs, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we did not get any pool info, neither incremental nor the whole pool, we probably talk
|
||||
// to a daemon that does not yet support giving back pool info with the 'getblocks' call,
|
||||
// and we have to update in the "old way"
|
||||
update_pool_state_by_pool_query(m_process_pool_txs, true);
|
||||
update_pool_state_by_pool_query(process_pool_txs, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3046,7 +3046,7 @@ void check_block_hard_fork_version(cryptonote::network_type nettype, uint8_t hf_
|
|||
daemon_is_outdated = height < start_height || height >= end_height;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::pull_and_parse_next_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, bool &last, bool &error, std::exception_ptr &exception)
|
||||
void wallet2::pull_and_parse_next_blocks(bool first, bool try_incremental, uint64_t start_height, uint64_t &blocks_start_height, std::list<crypto::hash> &short_chain_history, const std::vector<cryptonote::block_complete_entry> &prev_blocks, const std::vector<parsed_block> &prev_parsed_blocks, std::vector<cryptonote::block_complete_entry> &blocks, std::vector<parsed_block> &parsed_blocks, std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>>& process_pool_txs, bool &last, bool &error, std::exception_ptr &exception)
|
||||
{
|
||||
error = false;
|
||||
last = false;
|
||||
|
@ -3068,7 +3068,7 @@ void wallet2::pull_and_parse_next_blocks(bool first, bool try_incremental, uint6
|
|||
// pull the new blocks
|
||||
std::vector<cryptonote::COMMAND_RPC_GET_BLOCKS_FAST::block_output_indices> o_indices;
|
||||
uint64_t current_height;
|
||||
pull_blocks(first, try_incremental, start_height, blocks_start_height, short_chain_history, blocks, o_indices, current_height);
|
||||
pull_blocks(first, try_incremental, start_height, blocks_start_height, short_chain_history, blocks, o_indices, current_height, process_pool_txs);
|
||||
THROW_WALLET_EXCEPTION_IF(blocks.size() != o_indices.size(), error::wallet_internal_error, "Mismatched sizes of blocks and o_indices");
|
||||
|
||||
tools::threadpool& tpool = tools::threadpool::getInstanceForCompute();
|
||||
|
@ -3706,7 +3706,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||
|
||||
auto scope_exit_handler_hwdev = epee::misc_utils::create_scope_leave_handler([&](){hwdev.computing_key_images(false);});
|
||||
|
||||
m_process_pool_txs.clear();
|
||||
std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_pool_txs;
|
||||
// Getting and processing the pool state has moved down into method 'pull_blocks' to
|
||||
// allow for "conventional" as well as "incremental" update. However the following
|
||||
// principle of getting all info first (pool AND blocks) and only process txs afterwards
|
||||
|
@ -3738,7 +3738,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||
break;
|
||||
}
|
||||
if (!last)
|
||||
tpool.submit(&waiter, [&]{pull_and_parse_next_blocks(first, try_incremental, start_height, next_blocks_start_height, short_chain_history, blocks, parsed_blocks, next_blocks, next_parsed_blocks, last, error, exception);});
|
||||
tpool.submit(&waiter, [&]{pull_and_parse_next_blocks(first, try_incremental, start_height, next_blocks_start_height, short_chain_history, blocks, parsed_blocks, next_blocks, next_parsed_blocks, process_pool_txs, last, error, exception);});
|
||||
|
||||
if (!first)
|
||||
{
|
||||
|
@ -3857,8 +3857,8 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
|
|||
try
|
||||
{
|
||||
// If stop() is called we don't need to check pending transactions
|
||||
if (check_pool && m_run.load(std::memory_order_relaxed) && !m_process_pool_txs.empty())
|
||||
process_pool_state(m_process_pool_txs);
|
||||
if (check_pool && m_run.load(std::memory_order_relaxed) && !process_pool_txs.empty())
|
||||
process_pool_state(process_pool_txs);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue