diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2017-05-07 14:10:19 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2017-11-02 13:08:43 -0400 |
commit | da4908c3a05659846dae81b8d0bd73a04f7ed7c9 (patch) | |
tree | c3c0269c5244bb2bffd2459417c9ef34cdb77f3c /src/validation.cpp | |
parent | 41088795dd9a1c90bb379b2d5237d88ae8889c90 (diff) | |
download | bitcoin-da4908c3a05659846dae81b8d0bd73a04f7ed7c9.tar.xz |
Allow setting nMinimumChainWork on command line
Github-Pull: #10357
Rebased-From: 0311836f6927aec4ba5687ea12af35df3c509682
Diffstat (limited to 'src/validation.cpp')
-rw-r--r-- | src/validation.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 8bd23a0f1d..76b8401f1b 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -80,6 +80,7 @@ int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT; uint256 hashAssumeValid; +arith_uint256 nMinimumChainWork; CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; @@ -1032,8 +1033,6 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) bool IsInitialBlockDownload() { - const CChainParams& chainParams = Params(); - // Once this function has returned false, it must remain false. static std::atomic<bool> latchToFalse{false}; // Optimization: pre-test latch before taking the lock. @@ -1047,7 +1046,7 @@ bool IsInitialBlockDownload() return true; if (chainActive.Tip() == nullptr) return true; - if (chainActive.Tip()->nChainWork < UintToArith256(chainParams.GetConsensus().nMinimumChainWork)) + if (chainActive.Tip()->nChainWork < nMinimumChainWork) return true; if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge)) return true; @@ -1664,7 +1663,7 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd if (it != mapBlockIndex.end()) { if (it->second->GetAncestor(pindex->nHeight) == pindex && pindexBestHeader->GetAncestor(pindex->nHeight) == pindex && - pindexBestHeader->nChainWork >= UintToArith256(chainparams.GetConsensus().nMinimumChainWork)) { + pindexBestHeader->nChainWork >= nMinimumChainWork) { // This block is a member of the assumed verified chain and an ancestor of the best header. // The equivalent time check discourages hash power from extorting the network via DOS attack // into accepting an invalid block through telling users they must manually set assumevalid. |