diff --git a/src/init.cpp b/src/init.cpp index d88eadc40..887233079 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -476,6 +476,7 @@ std::string HelpMessage(HelpMessageMode mode) CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE))); strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file")); strUsage += HelpMessageOpt("-prunedebuglogfile", _("Prune (limit) filesize of debug.log")); // FIXME.SUGAR // prune debug.log + strUsage += HelpMessageOpt("-fastsync", _("Skip PoW check during IBD for faster sync")); // FIXME.SUGAR // skip PoW check during IBD if (showDebug) { strUsage += HelpMessageOpt("-printpriority", strprintf("Log transaction fee per kB when mining blocks (default: %u)", DEFAULT_PRINTPRIORITY)); @@ -831,6 +832,7 @@ void InitLogging() { fPrintToConsole = gArgs.GetBoolArg("-printtoconsole", false); fPruneDebugLog = gArgs.GetBoolArg("-prunedebuglogfile", false); // FIXME.SUGAR // prune debug.log + fFastSync = gArgs.GetBoolArg("-fastsync", false); // FIXME.SUGAR // skip PoW check during IBD fLogTimestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS); fLogTimeMicros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS); fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS); diff --git a/src/validation.cpp b/src/validation.cpp index 3cdc9be64..5013c5b56 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -228,6 +228,8 @@ uint64_t nPruneTarget = 0; int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT; +bool fFastSync = false; // FIXME.SUGAR // skip PoW check during IBD + uint256 hashAssumeValid; arith_uint256 nMinimumChainWork; @@ -3044,6 +3046,12 @@ static bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, static bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW = true) { + // FIXME.SUGAR // skip PoW check during IBD + if (fFastSync == true && IsInitialBlockDownload() == true) { + printf("Fast Sync Mode (fFastSync=%d)\n", fFastSync); + return true; + } + // Check proof of work matches claimed amount if (fCheckPOW && !CheckProofOfWork(block.GetPoWHash_cached(), block.nBits, consensusParams)) return state.DoS(50, false, REJECT_INVALID, "high-hash", false, "proof of work failed"); diff --git a/src/validation.h b/src/validation.h index 14ee44104..10db0fd79 100644 --- a/src/validation.h +++ b/src/validation.h @@ -193,6 +193,8 @@ extern CAmount maxTxFee; extern int64_t nMaxTipAge; extern bool fEnableReplacement; +extern bool fFastSync; // FIXME.SUGAR // skip PoW check during IBD + /** Block hash whose ancestors we will assume to have valid scripts without checking them. */ extern uint256 hashAssumeValid; @@ -230,7 +232,7 @@ static const unsigned int DEFAULT_CHECKLEVEL = 3; // Setting the target to > than 550MB will make it likely we can respect the target. static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; -/** +/** * Process an incoming block. This only returns after the best known valid * block is made active. Note that it does not, however, guarantee that the * specific block passed to it has been checked for validity! @@ -241,7 +243,7 @@ static const uint64_t MIN_DISK_SPACE_FOR_BLOCK_FILES = 550 * 1024 * 1024; * * Note that we guarantee that either the proof-of-work is valid on pblock, or * (and possibly also) BlockChecked will have been called. - * + * * Call without cs_main held. * * @param[in] pblock The block we want to process. @@ -367,7 +369,7 @@ bool CheckSequenceLocks(const CTransaction &tx, int flags, LockPoints* lp = null /** * Closure representing one script verification - * Note that this stores references to the spending transaction + * Note that this stores references to the spending transaction */ class CScriptCheck {