mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 21:22:47 +01:00
qt: get required locks upfront in polling functions
This avoids the GUI from getting stuck on periodical polls if the core is holding the locks for a longer time - for example, during a wallet rescan.
This commit is contained in:
@@ -92,6 +92,12 @@ double ClientModel::getVerificationProgress() const
|
||||
|
||||
void ClientModel::updateTimer()
|
||||
{
|
||||
// Get required lock upfront. This avoids the GUI from getting stuck on
|
||||
// periodical polls if the core is holding the locks for a longer time -
|
||||
// for example, during a wallet rescan.
|
||||
TRY_LOCK(cs_main, lockMain);
|
||||
if(!lockMain)
|
||||
return;
|
||||
// Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
|
||||
// Periodically check and update with a timer.
|
||||
int newNumBlocks = getNumBlocks();
|
||||
|
||||
Reference in New Issue
Block a user