aboutsummaryrefslogtreecommitdiff
path: root/src/chain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/chain.cpp')
-rw-r--r--src/chain.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/chain.cpp b/src/chain.cpp
index ffd58d471d..47acde882e 100644
--- a/src/chain.cpp
+++ b/src/chain.cpp
@@ -9,7 +9,7 @@
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) {
- if (pindex == NULL) {
+ if (pindex == nullptr) {
vChain.clear();
return;
}
@@ -49,8 +49,8 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const {
}
const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
- if (pindex == NULL) {
- return NULL;
+ if (pindex == nullptr) {
+ return nullptr;
}
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
@@ -63,7 +63,7 @@ CBlockIndex* CChain::FindEarliestAtLeast(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->GetBlockTimeMax() < time; });
- return (lower == vChain.end() ? NULL : *lower);
+ return (lower == vChain.end() ? nullptr : *lower);
}
/** Turn the lowest '1' bit in the binary representation of a number into a '0'. */
@@ -83,14 +83,14 @@ int static inline GetSkipHeight(int height) {
CBlockIndex* CBlockIndex::GetAncestor(int height)
{
if (height > nHeight || height < 0)
- return NULL;
+ return nullptr;
CBlockIndex* pindexWalk = this;
int heightWalk = nHeight;
while (heightWalk > height) {
int heightSkip = GetSkipHeight(heightWalk);
int heightSkipPrev = GetSkipHeight(heightWalk - 1);
- if (pindexWalk->pskip != NULL &&
+ if (pindexWalk->pskip != nullptr &&
(heightSkip == height ||
(heightSkip > height && !(heightSkipPrev < heightSkip - 2 &&
heightSkipPrev >= height)))) {
@@ -150,7 +150,7 @@ int64_t GetBlockProofEquivalentTime(const CBlockIndex& to, const CBlockIndex& fr
}
/** Find the last common ancestor two blocks have.
- * Both pa and pb must be non-NULL. */
+ * Both pa and pb must be non-nullptr. */
const CBlockIndex* LastCommonAncestor(const CBlockIndex* pa, const CBlockIndex* pb) {
if (pa->nHeight > pb->nHeight) {
pa = pa->GetAncestor(pb->nHeight);