Finalize parameter updates after snapshot definition
This commit is contained in:
parent
3137f04d41
commit
51d287559a
|
@ -43,7 +43,7 @@ public:
|
|||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||
consensus.nMajorityRejectBlockOutdated = 950;
|
||||
consensus.nMajorityWindow = 4000;
|
||||
consensus.powLimit = uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.powLimit = uint256S("07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||
consensus.nPowAveragingWindow = 17;
|
||||
assert(maxUint/UintToArith256(consensus.powLimit) >= consensus.nPowAveragingWindow);
|
||||
consensus.nPowMaxAdjustDown = 32; // 32% adjustment down
|
||||
|
@ -61,8 +61,8 @@ public:
|
|||
|
||||
pchMessageStart[0] = 0xa8;
|
||||
pchMessageStart[1] = 0xea;
|
||||
pchMessageStart[2] = 0xb2;
|
||||
pchMessageStart[3] = 0xed;
|
||||
pchMessageStart[2] = 0xa2;
|
||||
pchMessageStart[3] = 0xcd;
|
||||
vAlertPubKey = ParseHex("04f2cd746e629ffd320a81287474c98c2ad15d15b0a210b0144edcd8f3e1301c6311fd751fa34ba17d88090374cfec7cd9aaca55a5a0c4456511acc01b922005de");
|
||||
nDefaultPort = 7933;
|
||||
nMaxTipAge = 24 * 60 * 60;
|
||||
|
@ -200,8 +200,8 @@ public:
|
|||
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
|
||||
nForkStartHeight = 1000000;
|
||||
nForkHeightRange = 65000;
|
||||
nForkStartHeight = 272991;
|
||||
nForkHeightRange = 5467;
|
||||
}
|
||||
};
|
||||
static CMainParams mainParams;
|
||||
|
|
|
@ -712,6 +712,8 @@ static void ZC_LoadParams()
|
|||
pzcashParams->setProvingKeyPath(pk_path.string());
|
||||
}
|
||||
|
||||
bool IsInitialBlockDownloadBind(){ return IsInitialBlockDownload(false); }
|
||||
|
||||
bool AppInitServers(boost::thread_group& threadGroup)
|
||||
{
|
||||
RPCServer::OnStopped(&OnRPCStopped);
|
||||
|
@ -897,10 +899,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||
}
|
||||
|
||||
#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());
|
||||
forkHeightRange = GetArg("-fork-heightrange", chainparams.ForkHeightRange());
|
||||
forkCBPerBlock = GetArg("-fork-cbperblock", FORK_COINBASE_PER_BLOCK);
|
||||
LogPrintf("Running with fork parameters datadir=%s forkStartHeight=%d, forkHeightRange=%d\n", forkUtxoPath, forkStartHeight, forkHeightRange);
|
||||
#endif
|
||||
|
||||
// ********************************************************* 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
|
||||
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);
|
||||
scheduler.scheduleEvery(f, nPowTargetSpacing);
|
||||
|
||||
|
|
|
@ -1477,7 +1477,7 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
|||
return nSubsidy;
|
||||
}
|
||||
|
||||
bool IsInitialBlockDownload()
|
||||
bool IsInitialBlockDownload(bool includeFork)
|
||||
{
|
||||
const CChainParams& chainParams = Params();
|
||||
LOCK(cs_main);
|
||||
|
@ -1485,7 +1485,7 @@ bool IsInitialBlockDownload()
|
|||
return true;
|
||||
if (fCheckpointsEnabled && chainActive.Height() < Checkpoints::GetTotalBlocksEstimate(chainParams.Checkpoints()))
|
||||
return true;
|
||||
if (chainActive.Height() < chainParams.ForkStartHeight() + chainParams.ForkHeightRange())
|
||||
if (includeFork && chainActive.Height() < chainParams.ForkStartHeight() + chainParams.ForkHeightRange())
|
||||
return true;
|
||||
|
||||
static bool lockIBDState = false;
|
||||
|
|
|
@ -211,7 +211,7 @@ void ThreadScriptCheck();
|
|||
/** Try to detect Partition (network isolation) attacks against us */
|
||||
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) */
|
||||
bool IsInitialBlockDownload();
|
||||
bool IsInitialBlockDownload(bool includeFork=false);
|
||||
/** Format a string that describes several potential problems detected by the core */
|
||||
std::string GetWarnings(const std::string& strFor);
|
||||
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
|
||||
|
|
|
@ -720,6 +720,8 @@ void static BitcoinMiner()
|
|||
try {
|
||||
while (true) {
|
||||
if (chainparams.MiningRequiresPeers()) {
|
||||
bool fForkMiner = GetBoolArg("-fork-mine", false);
|
||||
|
||||
// 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.
|
||||
miningTimer.stop();
|
||||
|
@ -729,7 +731,7 @@ void static BitcoinMiner()
|
|||
LOCK(cs_vNodes);
|
||||
fvNodesEmpty = vNodes.empty();
|
||||
}
|
||||
if (!fvNodesEmpty && !IsInitialBlockDownload())
|
||||
if (!fvNodesEmpty && (fForkMiner || !IsInitialBlockDownload(true)))
|
||||
break;
|
||||
MilliSleep(1000);
|
||||
} while (true);
|
||||
|
@ -747,17 +749,6 @@ void static BitcoinMiner()
|
|||
|
||||
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 (!bForkModeStarted) {
|
||||
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;
|
||||
|
||||
arith_uint256 proofOfWorkLimit;
|
||||
if(isForkBlock(nHeight) || isForkBlock(nHeight - params.nPowAveragingWindow))
|
||||
proofOfWorkLimit = UintToArith256(uint256S("07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
||||
else
|
||||
proofOfWorkLimit = UintToArith256(params.powLimit);
|
||||
|
||||
arith_uint256 proofOfWorkLimit = UintToArith256(params.powLimit);
|
||||
unsigned int nProofOfWorkLimit = proofOfWorkLimit.GetCompact();
|
||||
unsigned int nProofOfWorkBomb = UintToArith256(uint256S("000000000000000000000000000000000000000000000000000000000000ffff")).GetCompact();
|
||||
|
||||
|
|
Loading…
Reference in New Issue