aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoin-chainstate.cpp
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-05-06 16:58:53 +0200
committerMacroFake <falke.marco@gmail.com>2022-08-16 17:26:40 +0200
commitfac04cb6ba1d032587bd02eab2247fd655a548cd (patch)
treebe6149a2a37ee881bccb119e08a1260a237d4a99 /src/bitcoin-chainstate.cpp
parentfac15ff673f0d6f84ea1eaae855597da02b0e510 (diff)
downloadbitcoin-fac04cb6ba1d032587bd02eab2247fd655a548cd.tar.xz
refactor: Add lock annotations to Active* methods
This is a refactor, putting the burden to think about thread safety to the caller. Otherwise, there is a risk that the caller will assume thread safety where none exists, as is evident in the previous two commits.
Diffstat (limited to 'src/bitcoin-chainstate.cpp')
-rw-r--r--src/bitcoin-chainstate.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp
index fc3f91d492..87f18371b1 100644
--- a/src/bitcoin-chainstate.cpp
+++ b/src/bitcoin-chainstate.cpp
@@ -115,12 +115,14 @@ int main(int argc, char* argv[])
// Main program logic starts here
std::cout
<< "Hello! I'm going to print out some information about your datadir." << std::endl
- << "\t" << "Path: " << gArgs.GetDataDirNet() << std::endl
+ << "\t" << "Path: " << gArgs.GetDataDirNet() << std::endl;
+ {
+ LOCK(chainman.GetMutex());
+ std::cout
<< "\t" << "Reindexing: " << std::boolalpha << node::fReindex.load() << std::noboolalpha << std::endl
<< "\t" << "Snapshot Active: " << std::boolalpha << chainman.IsSnapshotActive() << std::noboolalpha << std::endl
<< "\t" << "Active Height: " << chainman.ActiveHeight() << std::endl
<< "\t" << "Active IBD: " << std::boolalpha << chainman.ActiveChainstate().IsInitialBlockDownload() << std::noboolalpha << std::endl;
- {
CBlockIndex* tip = chainman.ActiveTip();
if (tip) {
std::cout << "\t" << tip->ToString() << std::endl;