diff options
author | Pedro Branco <branco@uphold.com> | 2016-06-16 15:57:48 +0100 |
---|---|---|
committer | Pedro Branco <branco@uphold.com> | 2016-10-19 15:17:13 +0100 |
commit | cb08fdbf78685b55029768524ca867772711c32b (patch) | |
tree | c41c0169a7a428f93527eb715ec2ae9de2df7e70 /src/chain.cpp | |
parent | 97c7f7362f9b59247753d6e8fa8022a6205f9c09 (diff) |
Add importmulti rpc call
Diffstat (limited to 'src/chain.cpp')
-rw-r--r-- | src/chain.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/chain.cpp b/src/chain.cpp index 77e924e703..1e611906d1 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -61,6 +61,13 @@ const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const { return pindex; } +CBlockIndex* CChain::FindLatestBefore(int64_t nTime) const +{ + std::vector<CBlockIndex*>::const_iterator lower = std::lower_bound(vChain.begin(), vChain.end(), nTime, + [](CBlockIndex* pBlock, const int64_t& time) -> bool { return pBlock->GetBlockTime() < time; }); + return (lower == vChain.end() ? NULL : *lower); +} + /** Turn the lowest '1' bit in the binary representation of a number into a '0'. */ int static inline InvertLowestOne(int n) { return n & (n - 1); } |