Add importmulti rpc call

This commit is contained in:
Pedro Branco
2016-06-16 15:57:48 +01:00
parent 97c7f7362f
commit cb08fdbf78
7 changed files with 698 additions and 0 deletions

View File

@@ -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); }