Finalize parameter updates after snapshot definition
This commit is contained in:
parent
3137f04d41
commit
51d287559a
|
@ -43,7 +43,7 @@ public:
|
||||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||||
consensus.nMajorityRejectBlockOutdated = 950;
|
consensus.nMajorityRejectBlockOutdated = 950;
|
||||||
consensus.nMajorityWindow = 4000;
|
consensus.nMajorityWindow = 4000;
|
||||||
consensus.powLimit = uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
consensus.powLimit = uint256S("07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||||
consensus.nPowAveragingWindow = 17;
|
consensus.nPowAveragingWindow = 17;
|
||||||
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
|
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
|
||||||
consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
|
consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
|
||||||
|
@ -61,8 +61,8 @@ public:
|
||||||
|
|
||||||
pchMessageStart[0] = 0xa8;
|
pchMessageStart[0] = 0xa8;
|
||||||
pchMessageStart[1] = 0xea;
|
pchMessageStart[1] = 0xea;
|
||||||
pchMessageStart[2] = 0xb2;
|
pchMessageStart[2] = 0xa2;
|
||||||
pchMessageStart[3] = 0xed;
|
pchMessageStart[3] = 0xcd;
|
||||||
vAlertPubKey = ParseHex("04f2cd746e629ffd320a81287474c98c2ad15d15b0a210b0144edcd8f3e1301c6311fd751fa34ba17d88090374cfec7cd9aaca55a5a0c4456511acc01b922005de");
|
vAlertPubKey = ParseHex("04f2cd746e629ffd320a81287474c98c2ad15d15b0a210b0144edcd8f3e1301c6311fd751fa34ba17d88090374cfec7cd9aaca55a5a0c4456511acc01b922005de");
|
||||||
nDefaultPort = 7933;
|
nDefaultPort = 7933;
|
||||||
nMaxTipAge = 24 * 60 * 60;
|
nMaxTipAge = 24 * 60 * 60;
|
||||||
|
@ -200,8 +200,8 @@ public:
|
||||||
assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
|
assert(vFoundersRewardAddress.size() <= consensus.GetLastFoundersRewardBlockHeight());
|
||||||
|
|
||||||
//current ZCL height is 200K-300K, this value here is placeholder, it will have to be changed to correct fork block height
|
//current ZCL height is 200K-300K, this value here is placeholder, it will have to be changed to correct fork block height
|
||||||
nForkStartHeight = 1000000;
|
nForkStartHeight = 272991;
|
||||||
nForkHeightRange = 65000;
|
nForkHeightRange = 5467;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static CMainParams mainParams;
|
static CMainParams mainParams;
|
||||||
|
|
|
@ -712,6 +712,8 @@ static void ZC_LoadParams()
|
||||||
pzcashParams->setProvingKeyPath(pk_path.string());
|
pzcashParams->setProvingKeyPath(pk_path.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsInitialBlockDownloadBind(){ return IsInitialBlockDownload(false); }
|
||||||
|
|
||||||
bool AppInitServers(boost::thread_group& threadGroup)
|
bool AppInitServers(boost::thread_group& threadGroup)
|
||||||
{
|
{
|
||||||
RPCServer::OnStopped(&OnRPCStopped);
|
RPCServer::OnStopped(&OnRPCStopped);
|
||||||
|
@ -897,10 +899,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FORK_CB_INPUT
|
#ifdef FORK_CB_INPUT
|
||||||
forkUtxoPath = GetArg("-utxo-path", "");
|
auto default_data_dir = GetDataDir() / "utxo_snapshot";
|
||||||
|
forkUtxoPath = GetArg("-utxo-path", default_data_dir.string());
|
||||||
forkStartHeight = GetArg("-fork-startheight", chainparams.ForkStartHeight());
|
forkStartHeight = GetArg("-fork-startheight", chainparams.ForkStartHeight());
|
||||||
forkHeightRange = GetArg("-fork-heightrange", chainparams.ForkHeightRange());
|
forkHeightRange = GetArg("-fork-heightrange", chainparams.ForkHeightRange());
|
||||||
forkCBPerBlock = GetArg("-fork-cbperblock", FORK_COINBASE_PER_BLOCK);
|
forkCBPerBlock = GetArg("-fork-cbperblock", FORK_COINBASE_PER_BLOCK);
|
||||||
|
LogPrintf("Running with fork parameters datadir=%s forkStartHeight=%d, forkHeightRange=%d\n", forkUtxoPath, forkStartHeight, forkHeightRange);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ********************************************************* Step 3: parameter-to-internal-flags
|
// ********************************************************* Step 3: parameter-to-internal-flags
|
||||||
|
@ -1697,7 +1701,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
|
|
||||||
// Monitor the chain, and alert if we get blocks much quicker or slower than expected
|
// Monitor the chain, and alert if we get blocks much quicker or slower than expected
|
||||||
int64_t nPowTargetSpacing = Params().GetConsensus().nPowTargetSpacing;
|
int64_t nPowTargetSpacing = Params().GetConsensus().nPowTargetSpacing;
|
||||||
CScheduler::Function f = boost::bind(&PartitionCheck, &IsInitialBlockDownload,
|
CScheduler::Function f = boost::bind(&PartitionCheck, &IsInitialBlockDownloadBind,
|
||||||
boost::ref(cs_main), boost::cref(pindexBestHeader), nPowTargetSpacing);
|
boost::ref(cs_main), boost::cref(pindexBestHeader), nPowTargetSpacing);
|
||||||
scheduler.scheduleEvery(f, nPowTargetSpacing);
|
scheduler.scheduleEvery(f, nPowTargetSpacing);
|
||||||
|
|
||||||
|
|
|
@ -1477,7 +1477,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
||||||
return nSubsidy;
|
return nSubsidy;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInitialBlockDownload()
|
bool IsInitialBlockDownload(bool includeFork)
|
||||||
{
|
{
|
||||||
const CChainParams& chainParams = Params();
|
const CChainParams& chainParams = Params();
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
@ -1485,7 +1485,7 @@ bool IsInitialBlockDownload()
|
||||||
return true;
|
return true;
|
||||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
||||||
return true;
|
return true;
|
||||||
if (chainActive.Height() < chainParams.ForkStartHeight() + chainParams.ForkHeightRange())
|
if (includeFork && chainActive.Height() < chainParams.ForkStartHeight() + chainParams.ForkHeightRange())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
static bool lockIBDState = false;
|
static bool lockIBDState = false;
|
||||||
|
|
|
@ -211,7 +211,7 @@ void ThreadScriptCheck();
|
||||||
/** Try to detect Partition (network isolation) attacks against us */
|
/** Try to detect Partition (network isolation) attacks against us */
|
||||||
void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const CBlockIndex *const &bestHeader, int64_t nPowTargetSpacing);
|
void PartitionCheck(bool (*initialDownloadCheck)(), CCriticalSection& cs, const CBlockIndex *const &bestHeader, int64_t nPowTargetSpacing);
|
||||||
/** Check whether we are doing an initial block download (synchronizing from disk or network) */
|
/** Check whether we are doing an initial block download (synchronizing from disk or network) */
|
||||||
bool IsInitialBlockDownload();
|
bool IsInitialBlockDownload(bool includeFork=false);
|
||||||
/** Format a string that describes several potential problems detected by the core */
|
/** Format a string that describes several potential problems detected by the core */
|
||||||
std::string GetWarnings(const std::string& strFor);
|
std::string GetWarnings(const std::string& strFor);
|
||||||
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
|
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
|
||||||
|
|
|
@ -720,6 +720,8 @@ void static BitcoinMiner()
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (chainparams.MiningRequiresPeers()) {
|
if (chainparams.MiningRequiresPeers()) {
|
||||||
|
bool fForkMiner = GetBoolArg("-fork-mine", false);
|
||||||
|
|
||||||
// Busy-wait for the network to come online so we don't waste time mining
|
// Busy-wait for the network to come online so we don't waste time mining
|
||||||
// on an obsolete chain. In regtest mode we expect to fly solo.
|
// on an obsolete chain. In regtest mode we expect to fly solo.
|
||||||
miningTimer.stop();
|
miningTimer.stop();
|
||||||
|
@ -729,7 +731,7 @@ void static BitcoinMiner()
|
||||||
LOCK(cs_vNodes);
|
LOCK(cs_vNodes);
|
||||||
fvNodesEmpty = vNodes.empty();
|
fvNodesEmpty = vNodes.empty();
|
||||||
}
|
}
|
||||||
if (!fvNodesEmpty && !IsInitialBlockDownload())
|
if (!fvNodesEmpty && (fForkMiner || !IsInitialBlockDownload(true)))
|
||||||
break;
|
break;
|
||||||
MilliSleep(1000);
|
MilliSleep(1000);
|
||||||
} while (true);
|
} while (true);
|
||||||
|
@ -747,17 +749,6 @@ void static BitcoinMiner()
|
||||||
|
|
||||||
bool isNextBlockFork = isForkBlock(pindexPrev->nHeight+1);
|
bool isNextBlockFork = isForkBlock(pindexPrev->nHeight+1);
|
||||||
|
|
||||||
bool mineOnlyFork = GetBoolArg("-forkmineonly", false);
|
|
||||||
if(mineOnlyFork && !isNextBlockFork) {
|
|
||||||
miningTimer.stop();
|
|
||||||
do {
|
|
||||||
MilliSleep(100);
|
|
||||||
pindexPrev = chainActive.Tip();
|
|
||||||
isNextBlockFork = isForkBlock(pindexPrev->nHeight + 1);
|
|
||||||
} while(!isNextBlockFork);
|
|
||||||
miningTimer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNextBlockFork) {
|
if (isNextBlockFork) {
|
||||||
if (!bForkModeStarted) {
|
if (!bForkModeStarted) {
|
||||||
LogPrintf("BTCPrivate Miner: switching into fork mode\n");
|
LogPrintf("BTCPrivate Miner: switching into fork mode\n");
|
||||||
|
|
|
@ -25,12 +25,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||||
{
|
{
|
||||||
int nHeight = pindexLast->nHeight + 1;
|
int nHeight = pindexLast->nHeight + 1;
|
||||||
|
|
||||||
arith_uint256 proofOfWorkLimit;
|
arith_uint256 proofOfWorkLimit = UintToArith256(params.powLimit);
|
||||||
if(isForkBlock(nHeight) || isForkBlock(nHeight - params.nPowAveragingWindow))
|
|
||||||
proofOfWorkLimit = UintToArith256(uint256S("07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
||||||
else
|
|
||||||
proofOfWorkLimit = UintToArith256(params.powLimit);
|
|
||||||
|
|
||||||
unsigned int nProofOfWorkLimit = proofOfWorkLimit.GetCompact();
|
unsigned int nProofOfWorkLimit = proofOfWorkLimit.GetCompact();
|
||||||
unsigned int nProofOfWorkBomb = UintToArith256(uint256S("000000000000000000000000000000000000000000000000000000000000ffff")).GetCompact();
|
unsigned int nProofOfWorkBomb = UintToArith256(uint256S("000000000000000000000000000000000000000000000000000000000000ffff")).GetCompact();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue