Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Copyright (c) 2017-2018 The Bitcoin developers | // Copyright (c) 2017-2018 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "arith_uint256.h" | #include "arith_uint256.h" | ||||
#include "blockindexworkcomparator.h" | #include "blockindexworkcomparator.h" | ||||
#include "blockvalidity.h" | #include "blockvalidity.h" | ||||
#include "chainparams.h" | #include "chainparams.h" | ||||
#include "checkpoints.h" | #include "checkpoints.h" | ||||
#include "checkqueue.h" | #include "checkqueue.h" | ||||
#include "config.h" | #include "config.h" | ||||
#include "consensus/activation.h" | |||||
#include "consensus/consensus.h" | #include "consensus/consensus.h" | ||||
#include "consensus/merkle.h" | #include "consensus/merkle.h" | ||||
#include "consensus/validation.h" | #include "consensus/validation.h" | ||||
#include "fs.h" | #include "fs.h" | ||||
#include "hash.h" | #include "hash.h" | ||||
#include "init.h" | #include "init.h" | ||||
#include "policy/fees.h" | #include "policy/fees.h" | ||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
▲ Show 20 Lines • Show All 511 Lines • ▼ Show 20 Lines | static bool IsCurrentForFeeEstimation() { | ||||
if (chainActive.Height() < pindexBestHeader->nHeight - 1) { | if (chainActive.Height() < pindexBestHeader->nHeight - 1) { | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
static bool IsUAHFenabled(const Config &config, int nHeight) { | |||||
return nHeight >= config.GetChainParams().GetConsensus().uahfHeight; | |||||
} | |||||
bool IsUAHFenabled(const Config &config, const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | |||||
return false; | |||||
} | |||||
return IsUAHFenabled(config, pindexPrev->nHeight); | |||||
} | |||||
static bool IsDAAEnabled(const Config &config, int nHeight) { | |||||
return nHeight >= config.GetChainParams().GetConsensus().daaHeight; | |||||
} | |||||
bool IsDAAEnabled(const Config &config, const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | |||||
return false; | |||||
} | |||||
return IsDAAEnabled(config, pindexPrev->nHeight); | |||||
} | |||||
static bool IsMagneticAnomalyEnabled(const Config &config, | |||||
int64_t nMedianTimePast) { | |||||
return nMedianTimePast >= gArgs.GetArg("-magneticanomalyactivationtime", | |||||
config.GetChainParams() | |||||
.GetConsensus() | |||||
.magneticAnomalyActivationTime); | |||||
} | |||||
bool IsMagneticAnomalyEnabled(const Config &config, | |||||
const CBlockIndex *pindexPrev) { | |||||
if (pindexPrev == nullptr) { | |||||
return false; | |||||
} | |||||
return IsMagneticAnomalyEnabled(config, pindexPrev->GetMedianTimePast()); | |||||
} | |||||
static bool IsMagneticAnomalyEnabledForCurrentBlock(const Config &config) { | static bool IsMagneticAnomalyEnabledForCurrentBlock(const Config &config) { | ||||
AssertLockHeld(cs_main); | AssertLockHeld(cs_main); | ||||
return IsMagneticAnomalyEnabled(config, chainActive.Tip()); | return IsMagneticAnomalyEnabled(config, chainActive.Tip()); | ||||
} | } | ||||
// Command-line argument "-replayprotectionactivationtime=<timestamp>" will | // Command-line argument "-replayprotectionactivationtime=<timestamp>" will | ||||
// cause the node to switch to replay protected SigHash ForkID value when the | // cause the node to switch to replay protected SigHash ForkID value when the | ||||
// median timestamp of the previous 11 blocks is greater than or equal to | // median timestamp of the previous 11 blocks is greater than or equal to | ||||
▲ Show 20 Lines • Show All 4,902 Lines • Show Last 20 Lines |