aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-07-03 07:37:15 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-07-03 07:38:16 -0400
commit915ac8a86192b10b753ce774a7d7c51c70a385f8 (patch)
tree7046fa373aabc889ff0ff410ba8baeced74a20e2 /src/validation.cpp
parentf61019f5a2c63d0a293e2ba2e57352d834f2c8d6 (diff)
parentfa0dfdf447d5b84a1849dc823d8508463600136a (diff)
Merge #19413: refactor: Remove confusing BlockIndex global
fa0dfdf447d5b84a1849dc823d8508463600136a refactor: Remove confusing BlockIndex global (MarcoFalke) Pull request description: The global `::BlockIndex()` is problematic for several reasons: * It returns a mutable reference to the block tree, without the appropriate lock annotation (`m_block_index` is guarded by `cs_main`). The current code is fine, but in the future this might lead to accidental races and data corruption. * The rpc server shouldn't rely on node globals, but rather a context that is passed in to the RPC method. * Tests might want to spin up their own block tree, and thus should also not rely on a single global. Fix all issues by removing the global ACKs for top commit: promag: Code review ACK fa0dfdf447d5b84a1849dc823d8508463600136a. jonatack: re-ACK fa0dfdf Tree-SHA512: 8f158fc5e1c67e73588a21c25677b3fa0fe442313b13ec24b87054806c59607d6ba0c062a865ce3e0ee568706bd0d1faa84febda21aff5bcd65dab172f74c52f
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index e59dda429c..4871a631dc 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1321,12 +1321,6 @@ bool CChainState::IsInitialBlockDownload() const
static CBlockIndex *pindexBestForkTip = nullptr, *pindexBestForkBase = nullptr;
-BlockMap& BlockIndex()
-{
- LOCK(::cs_main);
- return g_chainman.m_blockman.m_block_index;
-}
-
static void AlertNotify(const std::string& strMessage)
{
uiInterface.NotifyAlertChanged();