Skip to content

Commit 479b112

Browse files
authored
Merge pull request #2 from barrystyle/0.14-regentestnet
0.14 regentestnet
2 parents 6a657df + 0ec579a commit 479b112

File tree

5 files changed

+35
-49
lines changed

5 files changed

+35
-49
lines changed

src/chainparams.cpp

+3-15
Original file line numberDiff line numberDiff line change
@@ -485,21 +485,9 @@ class CTestNetParams : public CChainParams {
485485
nDefaultPort = 29999;
486486
nPruneAfterHeight = 1000;
487487

488-
/////////////////////////////////////////////////////////////////////////
489-
uint32_t nTime = 1563050000;
490-
uint32_t nNonce = 0;
491-
while (UintToArith256(genesis.GetHash()) >
492-
UintToArith256(consensus.powLimit))
493-
{
494-
nNonce++;
495-
genesis = CreateGenesisBlock(nTime, nNonce, 0x1f00ffff, 1, 0 * COIN);
496-
}
497-
genesis = CreateGenesisBlock(nTime, nNonce, 0x1f00ffff, 1, 0 * COIN);
498-
consensus.hashGenesisBlock = genesis.GetHash();
499-
/////////////////////////////////////////////////////////////////////////
500-
488+
genesis = CreateGenesisBlock(1563589000, 62255, 0x1f00ffff, 1, 0 * COIN);
501489
consensus.hashGenesisBlock = genesis.GetHash();
502-
// assert(consensus.hashGenesisBlock == uint256S("0x0000071f25514da6d65c4fa2187ef8ee1f6b6a68b7761af91ecfb28dc85d3e8a"));
490+
assert(consensus.hashGenesisBlock == uint256S("0x0000b67f0d64e977df72e86de5ef38e46b03d163790ed9a12e43240915be7197"));
503491

504492
vFixedSeeds.clear();
505493
vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));
@@ -549,7 +537,7 @@ class CTestNetParams : public CChainParams {
549537
};
550538

551539
chainTxData = ChainTxData{
552-
nTime, // * UNIX timestamp of last known number of transactions
540+
1563589000, // * UNIX timestamp of last known number of transactions
553541
0, // * total number of transactions between genesis and that timestamp
554542
// (the tx=... number in the SetBestChain debug.log lines)
555543
0.0 // * estimated number of transactions per second after that timestamp

src/kernel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ unsigned int getIntervalVersion(bool fTestNet)
3636

3737
// Hard checkpoints of stake modifiers to ensure they are deterministic
3838
static std::map<int, unsigned int> mapStakeModifierCheckpoints =
39-
boost::assign::map_list_of(0, 0xfd11f4e7);
39+
boost::assign::map_list_of(0, 0x0e00670b);
4040

4141
// Get time weight
4242
int64_t GetWeight(int64_t nIntervalBeginning, int64_t nIntervalEnd)

src/util.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ boost::filesystem::path GetDefaultDataDir()
571571
// Unix: ~/.dashcore
572572
#ifdef WIN32
573573
// Windows
574-
return GetSpecialFolderPath(CSIDL_APPDATA) / "pactestneta";
574+
return GetSpecialFolderPath(CSIDL_APPDATA) / "PACGlobal";
575575
#else
576576
fs::path pathRet;
577577
char* pszHome = getenv("HOME");
@@ -581,10 +581,10 @@ boost::filesystem::path GetDefaultDataDir()
581581
pathRet = fs::path(pszHome);
582582
#ifdef MAC_OSX
583583
// Mac
584-
return pathRet / "Library/Application Support/pactestneta";
584+
return pathRet / "Library/Application Support/PACGlobal";
585585
#else
586586
// Unix
587-
return pathRet / ".pactestneta";
587+
return pathRet / ".PACGlobal";
588588
#endif
589589
#endif
590590
}

src/validation.cpp

+26-28
Original file line numberDiff line numberDiff line change
@@ -3165,54 +3165,50 @@ bool ResetBlockFailureFlags(CBlockIndex *pindex) {
31653165
return true;
31663166
}
31673167

3168-
static void AcceptProofOfStakeBlock(const CBlock &block, CBlockIndex *pindexNew)
3168+
bool AcceptProofOfStakeBlock(const CBlock &block, CBlockIndex *pindex)
31693169
{
3170-
if(!pindexNew)
3171-
return;
3170+
if (!pindex)
3171+
return false;
31723172

31733173
if (block.IsProofOfStake()) {
3174-
pindexNew->SetProofOfStake();
3175-
pindexNew->prevoutStake = block.vtx[1]->vin[0].prevout;
3176-
pindexNew->nStakeTime = block.nTime;
3174+
pindex->SetProofOfStake();
3175+
pindex->prevoutStake = block.vtx[1]->vin[0].prevout;
3176+
pindex->nStakeTime = block.nTime;
31773177
} else {
3178-
pindexNew->prevoutStake.SetNull();
3179-
pindexNew->nStakeTime = 0;
3178+
pindex->prevoutStake.SetNull();
3179+
pindex->nStakeTime = 0;
31803180
}
31813181

3182-
//update previous block pointer
3183-
// pindexNew->pprev->pnext = pindexNew;
3184-
31853182
// ppcoin: compute chain trust score
3186-
pindexNew->bnChainTrust = (pindexNew->pprev ? pindexNew->pprev->bnChainTrust : ArithToUint256(0 + pindexNew->GetBlockTrust()));
3183+
pindex->bnChainTrust = (pindex->pprev ? pindex->pprev->bnChainTrust : ArithToUint256(0 + pindex->GetBlockTrust()));
31873184

31883185
// ppcoin: compute stake entropy bit for stake modifier
3189-
if (!pindexNew->SetStakeEntropyBit(pindexNew->GetStakeEntropyBit()))
3186+
if (!pindex->SetStakeEntropyBit(pindex->GetStakeEntropyBit()))
31903187
LogPrintf("AcceptProofOfStakeBlock() : SetStakeEntropyBit() failed \n");
31913188

3192-
uint256 hash = block.GetHash();
3193-
31943189
// ppcoin: record proof-of-stake hash value
3195-
if (pindexNew->IsProofOfStake()) {
3190+
if (pindex->IsProofOfStake()) {
3191+
uint256 hash = block.GetHash();
31963192
if (!mapProofOfStake.count(hash))
31973193
LogPrintf("AcceptProofOfStakeBlock() : hashProofOfStake not found in map \n");
3198-
pindexNew->hashProofOfStake = mapProofOfStake[hash];
3194+
pindex->hashProofOfStake = mapProofOfStake[hash];
31993195
}
32003196

32013197
// ppcoin: compute stake modifier
32023198
uint64_t nStakeModifier = 0;
32033199
bool fGeneratedStakeModifier = false;
3204-
if (!ComputeNextStakeModifier(pindexNew, nStakeModifier, fGeneratedStakeModifier))
3200+
if (!ComputeNextStakeModifier(pindex, nStakeModifier, fGeneratedStakeModifier))
32053201
LogPrintf("AcceptProofOfStakeBlock() : ComputeNextStakeModifier() failed \n");
3206-
pindexNew->SetStakeModifier(nStakeModifier, fGeneratedStakeModifier);
3207-
pindexNew->nStakeModifierChecksum = GetStakeModifierChecksum(pindexNew);
3208-
if (!CheckStakeModifierCheckpoints(pindexNew->nHeight, pindexNew->nStakeModifierChecksum)) {
3209-
LogPrintf("AcceptProofOfStakeBlock() : Rejected by stake modifier checkpoint height=%d, modifier=%s \n", pindexNew->nHeight, std::to_string(nStakeModifier));
3210-
LogPrintf("pindexNew->nStakeModifierChecksum = %08x\n", pindexNew->nStakeModifierChecksum);
3211-
} else {
3212-
LogPrintf("AcceptProofOfStakeBlock() : Accepted stake modifier - checksum %08x\n", pindexNew->nStakeModifierChecksum);
3202+
pindex->SetStakeModifier(nStakeModifier, fGeneratedStakeModifier);
3203+
pindex->nStakeModifierChecksum = GetStakeModifierChecksum(pindex);
3204+
if (!CheckStakeModifierCheckpoints(pindex->nHeight, pindex->nStakeModifierChecksum)) {
3205+
LogPrintf("AcceptProofOfStakeBlock() : Rejected by stake modifier checkpoint height=%d, modifier=0x%016llx, checksum=0x%08x\n",
3206+
pindex->nHeight, nStakeModifier, pindex->nStakeModifierChecksum);
3207+
return false;
32133208
}
32143209

3215-
setDirtyBlockIndex.insert(pindexNew);
3210+
setDirtyBlockIndex.insert(pindex);
3211+
return true;
32163212
}
32173213

32183214
CBlockIndex* AddToBlockIndex(const CBlockHeader& block, enum BlockStatus nStatus = BLOCK_VALID_TREE)
@@ -3794,7 +3790,8 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
37943790
return error("%s: %s", __func__, FormatStateMessage(state));
37953791
}
37963792

3797-
AcceptProofOfStakeBlock(block, pindex);
3793+
if (!AcceptProofOfStakeBlock(block, pindex))
3794+
return false;
37983795

37993796
// Header is valid/has work, merkle tree is good...RELAY NOW
38003797
// (but if it does not build on our best tip, let the SendMessages loop relay it)
@@ -4427,7 +4424,8 @@ static bool AddGenesisBlock(const CChainParams& chainparams, const CBlock& block
44274424
if (!WriteBlockToDisk(block, blockPos, chainparams.MessageStart()))
44284425
return error("%s: writing genesis block to disk failed", __func__);
44294426
CBlockIndex *pindex = AddToBlockIndex(block);
4430-
AcceptProofOfStakeBlock(block, pindex);
4427+
if (!AcceptProofOfStakeBlock(block, pindex))
4428+
return error("%s: genesis block not accepted", __func__);
44314429
if (!ReceivedBlockTransactions(block, state, pindex, blockPos))
44324430
return error("%s: genesis block not accepted", __func__);
44334431
return true;

src/version.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313

14-
static const int PROTOCOL_VERSION = 70215;
14+
static const int PROTOCOL_VERSION = 70216;
1515

1616
//! initial proto version, to be increased after version/verack negotiation
1717
static const int INIT_PROTO_VERSION = 209;
@@ -20,7 +20,7 @@ static const int INIT_PROTO_VERSION = 209;
2020
static const int GETHEADERS_VERSION = 70077;
2121

2222
//! disconnect from peers older than this proto version
23-
static const int MIN_PEER_PROTO_VERSION = 70213;
23+
static const int MIN_PEER_PROTO_VERSION = 70216;
2424

2525
//! nTime field added to CAddress, starting with this version;
2626
//! if possible, avoid requesting addresses nodes older than this

0 commit comments

Comments
 (0)