Fixed checkpoint data that was put into codebase without proper check for blockchain, breaking other blockchains or asset chains
This commit is contained in:
19
src/main.cpp
19
src/main.cpp
@@ -1906,7 +1906,7 @@ bool IsInitialBlockDownload()
|
||||
}
|
||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
||||
{
|
||||
//fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload\n");
|
||||
//fprintf(stderr,"IsInitialBlockDownload: checkpoint -> initialdownload - %d blocks\n", Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()));
|
||||
return true;
|
||||
}
|
||||
static bool lockIBDState = false;
|
||||
@@ -1949,7 +1949,7 @@ bool IsInSync()
|
||||
pbi = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
|
||||
if (fCheckpointsEnabled && pbi && (chainActive.Height() < pbi->nHeight))
|
||||
{
|
||||
//fprintf(stderr,"IsInSync: checkpoint -> initialdownload\n");
|
||||
//fprintf(stderr,"IsInSync: checkpoint -> initialdownload chainActive.Height().%d pbi->nHeight.%d\n", chainActive.Height(), pbi->nHeight);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -5948,8 +5948,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
CAddress addrMe;
|
||||
CAddress addrFrom;
|
||||
uint64_t nNonce = 1;
|
||||
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
|
||||
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
|
||||
int nVersion; // use temporary for version, don't set version number until validated as connected
|
||||
vRecv >> nVersion >> pfrom->nServices >> nTime >> addrMe;
|
||||
if (nVersion < MIN_PEER_PROTO_VERSION)
|
||||
{
|
||||
// disconnect from peers older than this proto version
|
||||
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
|
||||
@@ -5962,9 +5963,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
// When Overwinter is active, reject incoming connections from non-Overwinter nodes
|
||||
const Consensus::Params& params = Params().GetConsensus();
|
||||
if (NetworkUpgradeActive(GetHeight(), params, Consensus::UPGRADE_OVERWINTER)
|
||||
&& pfrom->nVersion < params.vUpgrades[Consensus::UPGRADE_OVERWINTER].nProtocolVersion)
|
||||
&& nVersion < params.vUpgrades[Consensus::UPGRADE_OVERWINTER].nProtocolVersion)
|
||||
{
|
||||
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
|
||||
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, nVersion);
|
||||
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
|
||||
strprintf("Version must be %d or greater",
|
||||
params.vUpgrades[Consensus::UPGRADE_OVERWINTER].nProtocolVersion));
|
||||
@@ -5972,8 +5973,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pfrom->nVersion == 10300)
|
||||
pfrom->nVersion = 300;
|
||||
if (nVersion == 10300)
|
||||
nVersion = 300;
|
||||
if (!vRecv.empty())
|
||||
vRecv >> addrFrom >> nNonce;
|
||||
if (!vRecv.empty()) {
|
||||
@@ -5994,6 +5995,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
pfrom->fDisconnect = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
pfrom->nVersion = nVersion;
|
||||
|
||||
pfrom->addrLocal = addrMe;
|
||||
if (pfrom->fInbound && addrMe.IsRoutable())
|
||||
|
||||
Reference in New Issue
Block a user