aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-01-12 00:23:09 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-03-06 19:52:19 +0000
commit92fabcd443322dcfdf2b3477515fae79e8647d86 (patch)
tree5511c22adffa3eaccb75afdd2ec53c81550ff7d3 /src/validation.h
parent43a32b739551b5a6cac8102afd52e2b9efc81726 (diff)
downloadbitcoin-92fabcd443322dcfdf2b3477515fae79e8647d86.tar.xz
Add LookupBlockIndex function
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/validation.h b/src/validation.h
index 99cbfdf1ee..e780f453b2 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -428,6 +428,13 @@ public:
/** Replay blocks that aren't fully applied to the database. */
bool ReplayBlocks(const CChainParams& params, CCoinsView* view);
+inline CBlockIndex* LookupBlockIndex(const uint256& hash)
+{
+ AssertLockHeld(cs_main);
+ BlockMap::const_iterator it = mapBlockIndex.find(hash);
+ return it == mapBlockIndex.end() ? nullptr : it->second;
+}
+
/** Find the last common block between the parameter chain and a locator. */
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator);