wallet_rpc_server: chunk refresh to keep responding to RPC while refreshing

This commit is contained in:
moneromooo-monero 2022-05-25 09:30:58 +00:00
parent 5bb2369b55
commit 23fde151ee
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 11 additions and 5 deletions

View file

@ -3360,7 +3360,7 @@ std::shared_ptr<std::map<std::pair<uint64_t, uint64_t>, size_t>> wallet2::create
return cache;
}
//----------------------------------------------------------------------------------------------------
void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched, bool& received_money, bool check_pool)
void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blocks_fetched, bool& received_money, bool check_pool, uint64_t max_blocks)
{
if (m_offline)
{
@ -3452,7 +3452,7 @@ void wallet2::refresh(bool trusted_daemon, uint64_t start_height, uint64_t & blo
update_pool_state(process_pool_txs, true);
bool first = true, last = false;
while(m_run.load(std::memory_order_relaxed))
while(m_run.load(std::memory_order_relaxed) && blocks_fetched < max_blocks)
{
uint64_t next_blocks_start_height;
std::vector<cryptonote::block_complete_entry> next_blocks;