[Refactor] ChainParams::consensus - Part 2#1344
Merged
furszy merged 7 commits intoPIVX-Project:masterfrom Feb 28, 2020
Merged
Conversation
1 task
Fuzzbawls
added a commit
that referenced
this pull request
Feb 22, 2020
64465b7 [Refactor] Consensus: Stake Modifier V2 (random-zebra) 8083725 [Refactor] Consensus: TimeProtocolV2 parameters (random-zebra) 4d1c696 [Refactor] Consensus: nStakeMinAge, nStakeMinDepth, nFutureTimeDrift (random-zebra) e69cee2 [Refactor] Consensus: restore nMaxMoneyOut as consensus param (random-zebra) 08a581d [Refactor] Consensus: fAllowMinDifficultyBlocks, fPowNoRetargeting (random-zebra) ca6ea3c [Refactor] Consensus: nTargetTimespan, nTargetSpacing, nTimeSlotLength (random-zebra) a281dee [Refactor] Consensus: remove unneeded getters. Rename BIP65Height (random-zebra) 284271c [Refactor] Consensus: bnProofOfWorkLimit / bnProofOfStakeLimit (v1-v2) (random-zebra) Pull request description: This PR builds on - [x] #1328 Populates the `consensus` struct with all relevant consensus parameters. Resets `nMaxMoneyOut` as chain param (with different value for TestNet). Cleans up several unneeded fields in ChainParams. EDIT: Current PR has been split in two. Second part is #1344 ACKs for top commit: furszy: good, utACK 64465b7. Fuzzbawls: utACK 64465b7 Tree-SHA512: d3e46bc8bb2ad9ee48abcbc4d4b1df2f59914360aaca72e93e19a5578248ecb95fd6a422477238e4736bc767d4e226f5b7f867174d96dcace73621946bf84df8
fddc127 to
b10358b
Compare
Author
|
Rebased after merge of #1341 |
b10358b to
5d6f5ae
Compare
Author
|
Rebased after merge of #1338 |
- nZerocoinStartHeight - nBlockZerocoinV2 - nBlockEnforceSerialRange - nBlockRecalculateAccumulators - nBlockFirstFraudulent - nBlockLastGoodCheckpoint (removed) - nModifierUpdateBlock - nFakeSerialBlockheightEnd - nBlockEnforceInvalidUTXO - nBlockDoubleAccumulated (removed) - nPublicZCSpends - nBlockEnforceNewMessageSignatures - nBlockV7StartHeight (removed) - nBlockLastAccumulatorCheckpoint
5d6f5ae to
fe13fe5
Compare
Author
|
Rebased after merging #1342 |
Fuzzbawls
requested changes
Feb 26, 2020
Collaborator
There was a problem hiding this comment.
Commit e253c7f2491316708e41cf944a3fb2c48386a9f4 results in testnet halting sync at block 201 due to the invalid nBits (referenced in #915). The changes here only take mainnet into consideration so need to add the testnet values back.
Suggested patch:
Index: src/chainparams.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/chainparams.cpp (revision 4d721223520870d03e44cd1df256f4fe76daa700)
+++ src/chainparams.cpp (date 1582681779760)
@@ -197,8 +197,8 @@
consensus.height_ZC_RecalcAccumulators = 908000;
// validation by-pass
- consensus.blk_259201_nTime = 1471401614; // Skip nBit validation of Block 259201 per PR #915
- consensus.blk_259201_nBits = 0x1c056dac; // Skip nBit validation of Block 259201 per PR #915
+ consensus.nPivxBadBlockTime = 1471401614; // Skip nBit validation of Block 259201 per PR #915
+ consensus.nPivxBadBlockBits = 0x1c056dac; // Skip nBit validation of Block 259201 per PR #915
// Zerocoin-related params
consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
@@ -319,6 +319,10 @@
consensus.height_start_ZC_SerialsV2 = 444020;
consensus.height_ZC_RecalcAccumulators = 999999999;
+ // validation by-pass
+ consensus.nPivxBadBlockTime = 1489001494; // Skip nBit validation of Block 201 per PR #915
+ consensus.nPivxBadBlockBits = 0x1e0a20bd; // Skip nBit validation of Block 201 per PR #915
+
// Zerocoin-related params
consensus.ZC_Modulus = "25195908475657893494027183240048398571429282126204032027777137836043662020707595556264018525880784"
"4069182906412495150821892985591491761845028084891200728449926873928072877767359714183472702618963750149718246911"
Index: src/consensus/params.h
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/consensus/params.h (revision 4d721223520870d03e44cd1df256f4fe76daa700)
+++ src/consensus/params.h (date 1582681711334)
@@ -69,8 +69,8 @@
int height_ZC_RecalcAccumulators;
// validation by-pass
- int64_t blk_259201_nTime;
- unsigned int blk_259201_nBits;
+ int64_t nPivxBadBlockTime;
+ unsigned int nPivxBadBlockBits;
int64_t TargetTimespan(const bool fV2 = true) const { return fV2 ? nTargetTimespanV2 : nTargetTimespan; }
Index: src/main.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/main.cpp (revision 4d721223520870d03e44cd1df256f4fe76daa700)
+++ src/main.cpp (date 1582681711329)
@@ -3854,8 +3854,8 @@
if (block.nBits != nBitsRequired) {
// Pivx Specific reference to the block with the wrong threshold was used.
const Consensus::Params& consensus = Params().GetConsensus();
- if ((block.nTime == (uint32_t) consensus.blk_259201_nTime) &&
- (block.nBits == (uint32_t) consensus.blk_259201_nTime)) {
+ if ((block.nTime == (uint32_t) consensus.nPivxBadBlockTime) &&
+ (block.nBits == (uint32_t) consensus.nPivxBadBlockBits)) {
// accept PIVX block minted with incorrect proof of work threshold
return true;
}fe13fe5 to
ac5ed53
Compare
Author
|
@Fuzzbawls good catch. Fixed in 98494ab |
- zerocoinModulus - nMaxZerocoinSpendsPerTransaction - nMaxZerocoinPublicSpendsPerTransaction - nMinZerocoinMintFee - nMintRequiredConfirmations - nRequiredAccumulation (removed) - nDefaultSecurityLevel (removed) - nZerocoinHeaderVersion (removed) - nZerocoinRequiredStakeDepth - nZerocoinStartTime
- nMasternodeCountDrift - nBudgetCycleBlocks - nProposalEstablishmentTime - nBudget_Fee_Confirmations - nStartMasternodePayments (removed) - strObfuscationPoolDummyAddress - nPoolMaxTransactions + spork keys handling
- nPivxBadBlockTime / nPivxBadBlocknBits - nInvalidAmountFiltered (moved outside chain params) - nMinColdStakingAmount (moved outside chain params) - fHeadersFirstSyncingActive (removed) - fTestnetToBeDeprecatedFieldRPC (removed) - fSkipProofOfWorkCheck (removed - use IsRegTestNet) - fRequireStandard (removed - use IsRegTestNet) - fDefaultConsistencyChecks (removed - use IsRegTestNet) - fMiningRequiresPeers (removed - use IsRegTestNet) - nMaxReorganizationDepth (moved outside chain params) - nEnforce[/nReject/nToCheck]BlockUpgradeMajority
ac5ed53 to
92221b1
Compare
Fuzzbawls
approved these changes
Feb 27, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second part of
Split as individual PR for ease of review.