Skip to content

Commit

Permalink
Fixes suggested by LTA for PR #42
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSlosh committed Nov 16, 2018
1 parent 0352579 commit bd6c384
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-seednode=<ip>", _("Connect to a node to retrieve peer addresses, and disconnect"));
strUsage += HelpMessageOpt("-timeout=<n>", strprintf(_("Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT));
strUsage += HelpMessageOpt("-bloomfilters", _("Allow peers to set bloom filters (default: 1)"));
strUsage += HelpMessageOpt("-fastsync", _("Increases maximum number of blocks to download at any given time and only minimal validates blocks"));
strUsage += HelpMessageOpt("-fastsync", _("Increases maximum number of in-flight blocks and only perform minimal block validation"));
#ifdef USE_UPNP
#if USE_UPNP
strUsage += HelpMessageOpt("-upnp", _("Use UPnP to map the listening port (default: 1 when listening)"));
Expand Down
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2699,7 +2699,7 @@ bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool f
bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bool fCheckMerkleRoot)
{
// Shortcut checks for almost all early blocks
if(chainActive.Height() < SKIP_VALIDATION_HEIGHT || GetBoolArg("-fastsync", false))
if(chainActive.Height() < SKIP_VALIDATION_HEIGHT && GetBoolArg("-fastsync", false))
{
const CChainParams& chainParams = Params();
// hit all the checkpoints but skip most of the rest
Expand Down Expand Up @@ -2889,7 +2889,8 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
}

// Since we're close to chaintip, reenable checks to ensure state is correct when sync completes
if(chainActive.Height() >= SKIP_VALIDATION_HEIGHT || GetBoolArg("-fastsync", false))
// Also reenable checks if -fastsync is not set
if(chainActive.Height() >= SKIP_VALIDATION_HEIGHT || (GetBoolArg("-fastsync", false) == false))
{
if (!CheckBlockHeader(block, state))
return false;
Expand Down

0 comments on commit bd6c384

Please sign in to comment.