Fixed checkpoint data that was put into codebase without proper check for blockchain, breaking other blockchains or asset chains
This commit is contained in:
@@ -235,12 +235,6 @@ void *chainparams_commandline(void *ptr)
|
|||||||
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
|
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
|
||||||
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
|
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
|
||||||
|
|
||||||
// only require coinbase protection on Verus from the Komodo family of coins
|
|
||||||
if (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0)
|
|
||||||
{
|
|
||||||
mainParams.consensus.fCoinbaseMustBeProtected = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH)
|
if (ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH)
|
||||||
{
|
{
|
||||||
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
|
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
|
||||||
@@ -262,22 +256,38 @@ void *chainparams_commandline(void *ptr)
|
|||||||
mainParams.consensus.nLwmaPOSAjustedWeight = 46531;
|
mainParams.consensus.nLwmaPOSAjustedWeight = 46531;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkpointData = //(Checkpoints::CCheckpointData)
|
// only require coinbase protection on Verus from the Komodo family of coins
|
||||||
{
|
if (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0)
|
||||||
boost::assign::map_list_of
|
{
|
||||||
(0, mainParams.consensus.hashGenesisBlock)
|
mainParams.consensus.fCoinbaseMustBeProtected = true;
|
||||||
(10000, uint256S("0xac2cd7d37177140ea4991cf630c0b9c7f94d707b84fb0351bf3a44856d2ae5dc"))
|
checkpointData = //(Checkpoints::CCheckpointData)
|
||||||
(20000, uint256S("0xb0e8cb9f77aaa7ff5bd90d6c08d06f4c4bf03e00c2b8a35a042e760845590c8a"))
|
{
|
||||||
(30000, uint256S("0xf2112ca577338ad7104bf905fa6a63d36b17a86f914c97b73cd31d43fcd7557c"))
|
boost::assign::map_list_of
|
||||||
(40000, uint256S("0x00000000008f83378dab727864b763ce91a4ea5f75d55939c0c1390cfb8c38f1"))
|
(0, mainParams.consensus.hashGenesisBlock)
|
||||||
(49170, uint256S("0x2add646c0089871ec2379f02f7cd60b3af6efd9c152a6f16fc10925458c270cc")),
|
(10000, uint256S("0xac2cd7d37177140ea4991cf630c0b9c7f94d707b84fb0351bf3a44856d2ae5dc"))
|
||||||
(int64_t)1529910234, // * UNIX timestamp of last checkpoint block
|
(20000, uint256S("0xb0e8cb9f77aaa7ff5bd90d6c08d06f4c4bf03e00c2b8a35a042e760845590c8a"))
|
||||||
(int64_t)63661, // * total number of transactions between genesis and last checkpoint
|
(30000, uint256S("0xf2112ca577338ad7104bf905fa6a63d36b17a86f914c97b73cd31d43fcd7557c"))
|
||||||
// (the tx=... number in the SetBestChain debug.log lines)
|
(40000, uint256S("0x00000000008f83378dab727864b763ce91a4ea5f75d55939c0c1390cfb8c38f1"))
|
||||||
(double)2777 // * estimated number of transactions per day after checkpoint
|
(49170, uint256S("0x2add646c0089871ec2379f02f7cd60b3af6efd9c152a6f16fc10925458c270cc")),
|
||||||
// total number of tx / (checkpoint block height / (24 * 24))
|
(int64_t)1529910234, // * UNIX timestamp of last checkpoint block
|
||||||
};
|
(int64_t)63661, // * total number of transactions between genesis and last checkpoint
|
||||||
|
// (the tx=... number in the SetBestChain debug.log lines)
|
||||||
|
(double)2777 // * estimated number of transactions per day after checkpoint
|
||||||
|
// total number of tx / (checkpoint block height / (24 * 24))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
checkpointData = //(Checkpoints::CCheckpointData)
|
||||||
|
{
|
||||||
|
boost::assign::map_list_of
|
||||||
|
(0, mainParams.consensus.hashGenesisBlock),
|
||||||
|
(int64_t)1231006505,
|
||||||
|
(int64_t)1,
|
||||||
|
(double)2777 // * estimated number of transactions per day after checkpoint
|
||||||
|
// total number of tx / (checkpoint block height / (24 * 24))
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
19
src/main.cpp
19
src/main.cpp
@@ -1906,7 +1906,7 @@ bool IsInitialBlockDownload()
|
|||||||
}
|
}
|
||||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
static bool lockIBDState = false;
|
static bool lockIBDState = false;
|
||||||
@@ -1949,7 +1949,7 @@ bool IsInSync()
|
|||||||
pbi = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
|
pbi = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
|
||||||
if (fCheckpointsEnabled && pbi && (chainActive.Height() < pbi->nHeight))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5948,8 +5948,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
CAddress addrMe;
|
CAddress addrMe;
|
||||||
CAddress addrFrom;
|
CAddress addrFrom;
|
||||||
uint64_t nNonce = 1;
|
uint64_t nNonce = 1;
|
||||||
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
|
int nVersion; // use temporary for version, don't set version number until validated as connected
|
||||||
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
|
vRecv >> nVersion >> pfrom->nServices >> nTime >> addrMe;
|
||||||
|
if (nVersion < MIN_PEER_PROTO_VERSION)
|
||||||
{
|
{
|
||||||
// disconnect from peers older than this proto version
|
// disconnect from peers older than this proto version
|
||||||
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
|
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
|
// When Overwinter is active, reject incoming connections from non-Overwinter nodes
|
||||||
const Consensus::Params& params = Params().GetConsensus();
|
const Consensus::Params& params = Params().GetConsensus();
|
||||||
if (NetworkUpgradeActive(GetHeight(), params, Consensus::UPGRADE_OVERWINTER)
|
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,
|
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
|
||||||
strprintf("Version must be %d or greater",
|
strprintf("Version must be %d or greater",
|
||||||
params.vUpgrades[Consensus::UPGRADE_OVERWINTER].nProtocolVersion));
|
params.vUpgrades[Consensus::UPGRADE_OVERWINTER].nProtocolVersion));
|
||||||
@@ -5972,8 +5973,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfrom->nVersion == 10300)
|
if (nVersion == 10300)
|
||||||
pfrom->nVersion = 300;
|
nVersion = 300;
|
||||||
if (!vRecv.empty())
|
if (!vRecv.empty())
|
||||||
vRecv >> addrFrom >> nNonce;
|
vRecv >> addrFrom >> nNonce;
|
||||||
if (!vRecv.empty()) {
|
if (!vRecv.empty()) {
|
||||||
@@ -5994,6 +5995,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
pfrom->fDisconnect = true;
|
pfrom->fDisconnect = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pfrom->nVersion = nVersion;
|
||||||
|
|
||||||
pfrom->addrLocal = addrMe;
|
pfrom->addrLocal = addrMe;
|
||||||
if (pfrom->fInbound && addrMe.IsRoutable())
|
if (pfrom->fInbound && addrMe.IsRoutable())
|
||||||
|
|||||||
@@ -799,7 +799,8 @@ int32_t waitForPeers(const CChainParams &chainparams)
|
|||||||
if (fvNodesEmpty || !IsInSync())
|
if (fvNodesEmpty || !IsInSync())
|
||||||
{
|
{
|
||||||
do {
|
do {
|
||||||
MilliSleep(1000 + rand() % 4000);
|
if (fvNodesEmpty)
|
||||||
|
MilliSleep(1000 + rand() % 4000);
|
||||||
{
|
{
|
||||||
LOCK(cs_vNodes);
|
LOCK(cs_vNodes);
|
||||||
fvNodesEmpty = vNodes.empty();
|
fvNodesEmpty = vNodes.empty();
|
||||||
|
|||||||
Reference in New Issue
Block a user