mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Solve chainActive-related locking issues
- In wallet and GUI code LOCK cs_main as well as cs_wallet when necessary - In main.cpp SendMessages move the TRY_LOCK(cs_main) up, to encompass the call to IsInitialBlockDownload. - Make ActivateBestChain, AddToBlockIndex, IsInitialBlockDownload, InitBlockIndex acquire the cs_main lock Fixes #3997
This commit is contained in:
parent
e07c943ce8
commit
55a1db4fa2
7 changed files with 269 additions and 272 deletions
|
|
@ -55,6 +55,7 @@ int ClientModel::getNumConnections(unsigned int flags) const
|
|||
|
||||
int ClientModel::getNumBlocks() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
return chainActive.Height();
|
||||
}
|
||||
|
||||
|
|
@ -76,6 +77,7 @@ quint64 ClientModel::getTotalBytesSent() const
|
|||
|
||||
QDateTime ClientModel::getLastBlockDate() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (chainActive.Tip())
|
||||
return QDateTime::fromTime_t(chainActive.Tip()->GetBlockTime());
|
||||
else
|
||||
|
|
@ -84,6 +86,7 @@ QDateTime ClientModel::getLastBlockDate() const
|
|||
|
||||
double ClientModel::getVerificationProgress() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
return Checkpoints::GuessVerificationProgress(chainActive.Tip());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue