diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-01-12 00:23:09 +0000 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-03-06 19:52:19 +0000 |
commit | 92fabcd443322dcfdf2b3477515fae79e8647d86 (patch) | |
tree | 5511c22adffa3eaccb75afdd2ec53c81550ff7d3 /src/validation.h | |
parent | 43a32b739551b5a6cac8102afd52e2b9efc81726 (diff) |
Add LookupBlockIndex function
Diffstat (limited to 'src/validation.h')
-rw-r--r-- | src/validation.h | 7 |
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); |