Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to >= 4 instead of > 3 to make min=req amount. Fix msg for thr… #316

Merged
merged 1 commit into from
Sep 20, 2018
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
6 changes: 3 additions & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class CMainParams : public CChainParams {
nDGWActivationBlock = 338778;

nMaxReorganizationDepth = 60; // 60 at 1 minute block timespan is +/- 60 minutes.
nMinReorganizationPeers = 3;
nMinReorganizationPeers = 4;
/** RVN End **/
}
};
Expand Down Expand Up @@ -394,7 +394,7 @@ class CTestNetParams : public CChainParams {
nDGWActivationBlock = 200;

nMaxReorganizationDepth = 60; // 60 at 1 minute block timespan is +/- 60 minutes.
nMinReorganizationPeers = 3;
nMinReorganizationPeers = 4;
/** RVN End **/

}
Expand Down Expand Up @@ -552,7 +552,7 @@ class CRegTestParams : public CChainParams {
nDGWActivationBlock = 200;

nMaxReorganizationDepth = 60; // 60 at 1 minute block timespan is +/- 60 minutes.
nMinReorganizationPeers = 3;
nMinReorganizationPeers = 4;
/** RVN End **/
}
};
Expand Down
8 changes: 6 additions & 2 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3528,8 +3528,12 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationSta
int nMaxReorgDepth = gArgs.GetArg("-maxreorg", Params().MaxReorganizationDepth());
int nMinReorgPeers = gArgs.GetArg("-minreorgpeers", Params().MinReorganizationPeers());
bool fGreaterThanMaxReorg = chainActive.Height() - nHeight >= nMaxReorgDepth;
if (fGreaterThanMaxReorg && g_connman && (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) > nMinReorgPeers && !IsInitialBlockDownload())
return state.DoS(1, error("%s: forked chain older than max reorganization depth (height %d), with connections (count %d), and (initial download %s)", __func__, nHeight, g_connman ? g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL) : -1, IsInitialBlockDownload() ? "true" : "false"), REJECT_MAXREORGDEPTH, "bad-fork-prior-to-maxreorgdepth");
if (fGreaterThanMaxReorg && g_connman) {
int nCurrentNodeCount = g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL);
bool bIsInitialBlockDownload = IsInitialBlockDownload();
if ((nCurrentNodeCount >= nMinReorgPeers) && !bIsInitialBlockDownload)
return state.DoS(1, error("%s: forked chain older than max reorganization depth (height %d), with connections (count %d), and (initial download %s)", __func__, nHeight, nCurrentNodeCount, bIsInitialBlockDownload ? "true" : "false"), REJECT_MAXREORGDEPTH, "bad-fork-prior-to-maxreorgdepth");
}

// Check proof of work
const Consensus::Params& consensusParams = params.GetConsensus();
Expand Down