Skip to content
This repository was archived by the owner on Jul 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ std::string HelpMessage()
strUsage += " -checklevel=<n> " + _("How thorough the block verification is (0-6, default: 1)") + "\n";
strUsage += " -loadblock=<file> " + _("Imports blocks from external blk000?.dat file") + "\n";
strUsage += " -maxorphanblocks=<n> " + strprintf(_("Keep at most <n> unconnectable blocks in memory (default: %u)"), DEFAULT_MAX_ORPHAN_BLOCKS) + "\n";
strUsage += " -backtoblock=<n> " + _("Rollback local block chain to block height <n>") + "\n";
strUsage += " -backtoblock=<n> " + _("Rollback local block chain to block height <n>") + "\n";
strUsage += " -maxblockheight=<n> " + _("Stop sync when block height reaches <n>") + "\n";

strUsage += "\n" + _("Block creation options:") + "\n";
strUsage += " -blockminsize=<n> " + _("Set minimum block size in bytes (default: 0)") + "\n";
Expand Down Expand Up @@ -466,9 +467,6 @@ bool AppInit2(boost::thread_group& threadGroup)
// Check for -debugnet (deprecated)
if (GetBoolArg("-debugnet", false))
InitWarning(_("Warning: Deprecated argument -debugnet ignored, use -debug=net"));
// Check for -socks - as this is a privacy risk to continue, exit here
if (mapArgs.count("-socks"))
return InitError(_("Error: Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported."));
if (fDaemon)
fServer = true;
else
Expand Down Expand Up @@ -797,14 +795,7 @@ bool AppInit2(boost::thread_group& threadGroup)

// ********************************************************* Step 7: load blockchain

if (GetBoolArg("-loadblockindextest", false))
{
CTxDB txdb("r");
txdb.LoadBlockIndex();
PrintBlockTree();
return false;
}

maxBlockHeight = GetArg("-maxblockheight", -1);
uiInterface.InitMessage(_("Loading block index..."));

nStart = GetTimeMillis();
Expand Down
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,6 @@ void Misbehaving(NodeId pnode, int howmuch)
bool ProcessBlock(CNode* pfrom, CBlock* pblock)
{
AssertLockHeld(cs_main);

// Check for duplicate
uint256 hash = pblock->GetHash();
if (mapBlockIndex.count(hash))
Expand Down Expand Up @@ -3766,6 +3765,10 @@ void static ProcessGetData(CNode* pfrom)

bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
// this is a snapshot node. will only sync until certain block
if (maxBlockHeight != -1 && pindexBest->nHeight >= maxBlockHeight) {
return;
}
RandAddSeedPerfmon();
LogPrint("net", "received: %s (%u bytes)\n", strCommand, vRecv.size());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
Expand Down
4 changes: 4 additions & 0 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,10 @@ void CMasternodeMan::ProcessMasternodeConnections()
void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CDataStream& vRecv)
{

// this is a snapshot node. will only sync until certain block
if (maxBlockHeight != -1 && pindexBest->nHeight >= maxBlockHeight) {
return;
}
//Normally would disable functionality, NEED this enabled for staking.
//if(fLiteMode) return;

Expand Down
1 change: 1 addition & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ string strRollbackToBlock = "";
int64_t nMasterNodeChecksDelayBaseTime = 0;
//MasterNode peer IP advanced relay system toggle
bool fMnAdvRelay = false;
int maxBlockHeight = -1;

// Init OpenSSL library multithreading support
static CCriticalSection** ppmutexOpenSSL;
Expand Down
2 changes: 2 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ extern std::string strRollbackToBlock;
extern int64_t nMasterNodeChecksDelayBaseTime;
//MasterNode peer IP advanced relay system toggle
extern bool fMnAdvRelay;
//will sync until this block height. default -1 which represents disabled
extern int maxBlockHeight;

void RandAddSeed();
void RandAddSeedPerfmon();
Expand Down