From 8a2aaebd7efdd7dd224e37d452c735620e9d3c2d Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Fri, 9 Oct 2020 11:48:23 -0600 Subject: [PATCH] Ensure conflicting flags are reported as an error. --- src/init.cpp | 4 ++++ src/main.cpp | 10 +++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index b0da47077..763b274c7 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -967,6 +967,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) fIBDSkipTxVerification = GetBoolArg("-ibdskiptxverification", DEFAULT_IBD_SKIP_TX_VERIFICATION); fCheckpointsEnabled = GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED); + if (fIBDSkipTxVerification && !fCheckpointsEnabled) { + return InitError(_("-ibdskiptxverification requires checkpoints to be enabled; it is incompatible with -nocheckpoints")); + } + // -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency nScriptCheckThreads = GetArg("-par", DEFAULT_SCRIPTCHECK_THREADS); if (nScriptCheckThreads <= 0) diff --git a/src/main.cpp b/src/main.cpp index 3d55c1ba6..afa8b7632 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4285,12 +4285,11 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state /** * Store block on disk. + * If dbp is non-NULL, the file is known to already reside on disk. * * JoinSplit proofs are not verified here; the only caller of AcceptBlock - * (ProcessNewBlock) invokes ActivateBestChain, which ultimately calls + * (ProcessNewBlock) later invokes ActivateBestChain, which ultimately calls * ConnectBlock in a manner that can verify the proofs - * - * If dbp is non-NULL, the file is known to already reside on disk */ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp) { @@ -4322,10 +4321,7 @@ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CCha if (fTooFarAhead) return true; // Block height is too high } - // See method docstring for why this is always disabled. The only caller of - // AcceptBlock (ProcessNewBlock) will fully check proofs when it eventually - // delegates to `ConnectTip` and thereafter `ConnectBlock`. This - // arrangement is a bit fragile and should be reconsidered. + // See method docstring for why this is always disabled. auto verifier = ProofVerifier::Disabled(); bool skipTxVerification = IBDSkipTxVerification(chainparams, pindex); if ((!CheckBlock(block, state, chainparams, verifier, true, true, !skipTxVerification)) ||