Skip to content

Commit 7c673bf

Browse files
committed
[Refactor] Consensus: masternode/budget-related fields
- nMasternodeCountDrift - nBudgetCycleBlocks - nProposalEstablishmentTime - nBudget_Fee_Confirmations - nStartMasternodePayments (removed) - strObfuscationPoolDummyAddress - nPoolMaxTransactions + spork keys handling
1 parent 7736d6c commit 7c673bf

File tree

12 files changed

+104
-105
lines changed

12 files changed

+104
-105
lines changed

src/chainparams.cpp

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,31 @@ class CMainParams : public CChainParams
148148
assert(genesis.hashMerkleRoot == uint256("0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b"));
149149

150150
consensus.fPowAllowMinDifficultyBlocks = false;
151-
consensus.powLimit = ~uint256(0) >> 20; // PIVX starting difficulty is 1 / 2^12
151+
consensus.powLimit = ~uint256(0) >> 20; // PIVX starting difficulty is 1 / 2^12
152152
consensus.posLimitV1 = ~uint256(0) >> 24;
153153
consensus.posLimitV2 = ~uint256(0) >> 20;
154+
consensus.nBudgetCycleBlocks = 43200; // approx. 1 every 30 days
155+
consensus.nBudgetFeeConfirmations = 6; // Number of confirmations for the finalization fee
154156
consensus.nCoinbaseMaturity = 100;
155157
consensus.nFutureTimeDriftPoW = 7200;
156158
consensus.nFutureTimeDriftPoS = 180;
159+
consensus.nMasternodeCountDrift = 20; // num of MN we allow the see-saw payments to be off by
157160
consensus.nMaxMoneyOut = 21000000 * COIN;
161+
consensus.nPoolMaxTransactions = 3;
162+
consensus.nProposalEstablishmentTime = 60 * 60 * 24; // must be at least a day old to make it into a budget
158163
consensus.nStakeMinAge = 60 * 60;
159164
consensus.nStakeMinDepth = 600;
160165
consensus.nTargetTimespan = 40 * 60;
161166
consensus.nTargetTimespanV2 = 30 * 60;
162167
consensus.nTargetSpacing = 1 * 60;
163168
consensus.nTimeSlotLength = 15;
169+
consensus.strObfuscationPoolDummyAddress = "D87q2gC9j6nNrnzCsg4aY6bHMLsT9nUhEw";
170+
171+
// spork keys
172+
consensus.strSporkPubKey = "040F129DE6546FE405995329A887329BED4321325B1A73B0A257423C05C1FCFE9E40EF0678AEF59036A22C42E61DFD29DF7EFB09F56CC73CADF64E05741880E3E7";
173+
consensus.strSporkPubKeyOld = "0499A7AF4806FC6DE640D23BC5936C29B77ADF2174B4F45492727F897AE63CF8D27B2F05040606E0D14B547916379FA10716E344E745F880EDC037307186AA25B7";
174+
consensus.nTime_EnforceNewSporkKey = 1566860400; //!> August 26, 2019 11:00:00 PM GMT
175+
consensus.nTime_RejectOldSporkKey = 1569538800; //!> September 26, 2019 11:00:00 PM GMT
164176

165177
// height-based activations
166178
consensus.height_last_PoW = 259200;
@@ -211,15 +223,12 @@ class CMainParams : public CChainParams
211223
nRejectBlockOutdatedMajority = 10260; // 95%
212224
nToCheckBlockUpgradeMajority = 10800; // Approximate expected amount of blocks in 7 days (1440*7.5)
213225
nMinerThreads = 0;
214-
nMasternodeCountDrift = 20;
215226
nMinColdStakingAmount = 1 * COIN;
216227

217228
/** Height or Time Based Activations **/
218229
nPivxBadBlockTime = 1471401614; // Skip nBit validation of Block 259201 per PR #915
219230
nPivxBadBlocknBits = 0x1c056dac; // Skip nBit validation of Block 259201 per PR #915
220231
nInvalidAmountFiltered = 268200*COIN; //Amount of invalid coins filtered through exchanges, that should be considered valid
221-
nEnforceNewSporkKey = 1566860400; //!> Sporks signed after Monday, August 26, 2019 11:00:00 PM GMT must use the new spork key
222-
nRejectOldSporkKey = 1569538800; //!> Fully reject old spork key after Thursday, September 26, 2019 11:00:00 PM GMT
223232

224233
// Note that of those with the service bits flag, most only support a subset of possible options
225234
vSeeds.push_back(CDNSSeedData("fuzzbawls.pw", "pivx.seed.fuzzbawls.pw")); // Primary DNS Seeder from Fuzzbawls
@@ -243,16 +252,6 @@ class CMainParams : public CChainParams
243252
fSkipProofOfWorkCheck = false;
244253
fTestnetToBeDeprecatedFieldRPC = false;
245254
fHeadersFirstSyncingActive = false;
246-
247-
nPoolMaxTransactions = 3;
248-
nBudgetCycleBlocks = 43200; //!< Amount of blocks in a months period of time (using 1 minutes per) = (60*24*30)
249-
strSporkPubKey = "040F129DE6546FE405995329A887329BED4321325B1A73B0A257423C05C1FCFE9E40EF0678AEF59036A22C42E61DFD29DF7EFB09F56CC73CADF64E05741880E3E7";
250-
strSporkPubKeyOld = "0499A7AF4806FC6DE640D23BC5936C29B77ADF2174B4F45492727F897AE63CF8D27B2F05040606E0D14B547916379FA10716E344E745F880EDC037307186AA25B7";
251-
strObfuscationPoolDummyAddress = "D87q2gC9j6nNrnzCsg4aY6bHMLsT9nUhEw";
252-
nStartMasternodePayments = 1403728576; //Wed, 25 Jun 2014 20:36:16 GMT
253-
254-
nBudget_Fee_Confirmations = 6; // Number of confirmations for the finalization fee
255-
nProposalEstablishmentTime = 60 * 60 * 24; // Proposals must be at least a day old to make it into a budget
256255
}
257256

258257
const Checkpoints::CCheckpointData& Checkpoints() const
@@ -280,19 +279,31 @@ class CTestNetParams : public CMainParams
280279
assert(genesis.hashMerkleRoot == uint256("0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b"));
281280

282281
consensus.fPowAllowMinDifficultyBlocks = true;
283-
consensus.powLimit = ~uint256(0) >> 20; // PIVX starting difficulty is 1 / 2^12
282+
consensus.powLimit = ~uint256(0) >> 20; // PIVX starting difficulty is 1 / 2^12
284283
consensus.posLimitV1 = ~uint256(0) >> 24;
285284
consensus.posLimitV2 = ~uint256(0) >> 20;
285+
consensus.nBudgetCycleBlocks = 144; // approx 10 cycles per day
286+
consensus.nBudgetFeeConfirmations = 3; // (only 8-blocks window for finalization on testnet)
286287
consensus.nCoinbaseMaturity = 15;
287288
consensus.nFutureTimeDriftPoW = 7200;
288289
consensus.nFutureTimeDriftPoS = 180;
290+
consensus.nMasternodeCountDrift = 4; // num of MN we allow the see-saw payments to be off by
289291
consensus.nMaxMoneyOut = 43199500 * COIN;
292+
consensus.nPoolMaxTransactions = 2;
293+
consensus.nProposalEstablishmentTime = 60 * 5; // at least 5 min old to make it into a budget
290294
consensus.nStakeMinAge = 60 * 60;
291295
consensus.nStakeMinDepth = 100;
292296
consensus.nTargetTimespan = 40 * 60;
293297
consensus.nTargetTimespanV2 = 30 * 60;
294298
consensus.nTargetSpacing = 1 * 60;
295299
consensus.nTimeSlotLength = 15;
300+
consensus.strObfuscationPoolDummyAddress = "y57cqfGRkekRyDRNeJiLtYVEbvhXrNbmox";
301+
302+
// spork keys
303+
consensus.strSporkPubKey = "04E88BB455E2A04E65FCC41D88CD367E9CCE1F5A409BE94D8C2B4B35D223DED9C8E2F4E061349BA3A38839282508066B6DC4DB72DD432AC4067991E6BF20176127";
304+
consensus.strSporkPubKeyOld = "04A8B319388C0F8588D238B9941DC26B26D3F9465266B368A051C5C100F79306A557780101FE2192FE170D7E6DEFDCBEE4C8D533396389C0DAFFDBC842B002243C";
305+
consensus.nTime_EnforceNewSporkKey = 1566860400; //!> August 26, 2019 11:00:00 PM GMT
306+
consensus.nTime_RejectOldSporkKey = 1569538800; //!> September 26, 2019 11:00:00 PM GMT
296307

297308
// height based activations
298309
consensus.height_last_PoW = 200;
@@ -345,10 +356,7 @@ class CTestNetParams : public CMainParams
345356
nMinerThreads = 0;
346357
nPivxBadBlockTime = 1489001494; // Skip nBit validation of Block 259201 per PR #915
347358
nPivxBadBlocknBits = 0x1e0a20bd; // Skip nBit validation of Block 201 per PR #915
348-
nMasternodeCountDrift = 4;
349359
nInvalidAmountFiltered = 0; //Amount of invalid coins filtered through exchanges, that should be considered valid
350-
nEnforceNewSporkKey = 1566860400; //!> Sporks signed after Monday, August 26, 2019 11:00:00 PM GMT must use the new spork key
351-
nRejectOldSporkKey = 1569538800; //!> Reject old spork key after Thursday, September 26, 2019 11:00:00 PM GMT
352360

353361
vFixedSeeds.clear();
354362
vSeeds.clear();
@@ -373,18 +381,8 @@ class CTestNetParams : public CMainParams
373381
fDefaultConsistencyChecks = false;
374382
fRequireStandard = true;
375383
fTestnetToBeDeprecatedFieldRPC = true;
376-
377-
nPoolMaxTransactions = 2;
378-
nBudgetCycleBlocks = 144; //!< Ten cycles per day on testnet
379-
strSporkPubKey = "04E88BB455E2A04E65FCC41D88CD367E9CCE1F5A409BE94D8C2B4B35D223DED9C8E2F4E061349BA3A38839282508066B6DC4DB72DD432AC4067991E6BF20176127";
380-
strSporkPubKeyOld = "04A8B319388C0F8588D238B9941DC26B26D3F9465266B368A051C5C100F79306A557780101FE2192FE170D7E6DEFDCBEE4C8D533396389C0DAFFDBC842B002243C";
381-
strObfuscationPoolDummyAddress = "y57cqfGRkekRyDRNeJiLtYVEbvhXrNbmox";
382-
nStartMasternodePayments = 1420837558; //Fri, 09 Jan 2015 21:05:58 GMT
383-
nBudget_Fee_Confirmations = 3; // Number of confirmations for the finalization fee. We have to make this very short
384-
// here because we only have a 8 block finalization window on testnet
385-
386-
nProposalEstablishmentTime = 60 * 5; // Proposals must be at least 5 mns old to make it into a test budget
387384
}
385+
388386
const Checkpoints::CCheckpointData& Checkpoints() const
389387
{
390388
return dataTestnet;
@@ -409,19 +407,35 @@ class CRegTestParams : public CTestNetParams
409407
assert(genesis.hashMerkleRoot == uint256("0x1b2ef6e2f28be914103a277377ae7729dcd125dfeb8bf97bd5964ba72b6dc39b"));
410408

411409
consensus.fPowAllowMinDifficultyBlocks = true;
412-
consensus.powLimit = ~uint256(0) >> 20; // PIVX starting difficulty is 1 / 2^12
410+
consensus.powLimit = ~uint256(0) >> 20; // PIVX starting difficulty is 1 / 2^12
413411
consensus.posLimitV1 = ~uint256(0) >> 24;
414412
consensus.posLimitV2 = ~uint256(0) >> 20;
413+
consensus.nBudgetCycleBlocks = 144; // approx 10 cycles per day
414+
consensus.nBudgetFeeConfirmations = 3; // (only 8-blocks window for finalization on regtest)
415415
consensus.nCoinbaseMaturity = 100;
416416
consensus.nFutureTimeDriftPoW = 7200;
417417
consensus.nFutureTimeDriftPoS = 180;
418+
consensus.nMasternodeCountDrift = 4; // num of MN we allow the see-saw payments to be off by
418419
consensus.nMaxMoneyOut = 43199500 * COIN;
420+
consensus.nPoolMaxTransactions = 2;
421+
consensus.nProposalEstablishmentTime = 60 * 5; // at least 5 min old to make it into a budget
419422
consensus.nStakeMinAge = 0;
420423
consensus.nStakeMinDepth = 0;
421424
consensus.nTargetTimespan = 40 * 60;
422425
consensus.nTargetTimespanV2 = 30 * 60;
423426
consensus.nTargetSpacing = 1 * 60;
424427
consensus.nTimeSlotLength = 15;
428+
consensus.strObfuscationPoolDummyAddress = "y57cqfGRkekRyDRNeJiLtYVEbvhXrNbmox";
429+
430+
/* Spork Key for RegTest:
431+
WIF private key: 932HEevBSujW2ud7RfB1YF91AFygbBRQj3de3LyaCRqNzKKgWXi
432+
private key hex: bd4960dcbd9e7f2223f24e7164ecb6f1fe96fc3a416f5d3a830ba5720c84b8ca
433+
Address: yCvUVd72w7xpimf981m114FSFbmAmne7j9
434+
*/
435+
consensus.strSporkPubKey = "043969b1b0e6f327de37f297a015d37e2235eaaeeb3933deecd8162c075cee0207b13537618bde640879606001a8136091c62ec272dd0133424a178704e6e75bb7";
436+
consensus.strSporkPubKeyOld = "";
437+
consensus.nTime_EnforceNewSporkKey = 0;
438+
consensus.nTime_RejectOldSporkKey = 0;
425439

426440
// height based activations
427441
consensus.height_last_PoW = 250;
@@ -472,7 +486,6 @@ class CRegTestParams : public CTestNetParams
472486
nRejectBlockOutdatedMajority = 950;
473487
nToCheckBlockUpgradeMajority = 1000;
474488
nMinerThreads = 1;
475-
nMasternodeCountDrift = 4;
476489

477490
vFixedSeeds.clear(); //! Testnet mode doesn't have any fixed seeds.
478491
vSeeds.clear(); //! Testnet mode doesn't have any DNS seeds.
@@ -482,14 +495,8 @@ class CRegTestParams : public CTestNetParams
482495
fRequireStandard = false;
483496
fSkipProofOfWorkCheck = true;
484497
fTestnetToBeDeprecatedFieldRPC = false;
485-
486-
/* Spork Key for RegTest:
487-
WIF private key: 932HEevBSujW2ud7RfB1YF91AFygbBRQj3de3LyaCRqNzKKgWXi
488-
private key hex: bd4960dcbd9e7f2223f24e7164ecb6f1fe96fc3a416f5d3a830ba5720c84b8ca
489-
Address: yCvUVd72w7xpimf981m114FSFbmAmne7j9
490-
*/
491-
strSporkPubKey = "043969b1b0e6f327de37f297a015d37e2235eaaeeb3933deecd8162c075cee0207b13537618bde640879606001a8136091c62ec272dd0133424a178704e6e75bb7";
492498
}
499+
493500
const Checkpoints::CCheckpointData& Checkpoints() const
494501
{
495502
return dataRegtest;

src/chainparams.h

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ class CChainParams
7676
/** Make standard checks */
7777
bool RequireStandard() const { return fRequireStandard; }
7878

79-
/** The masternode count that we will allow the see-saw reward payments to be off by */
80-
int MasternodeCountDrift() const { return nMasternodeCountDrift; }
8179
/** In the future use NetworkIDString() for RPC fields */
8280
bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; }
8381
/** Return the BIP70 network string (main, test or regtest) */
@@ -86,22 +84,9 @@ class CChainParams
8684
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
8785
const std::vector<CAddress>& FixedSeeds() const { return vFixedSeeds; }
8886
virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0;
89-
int PoolMaxTransactions() const { return nPoolMaxTransactions; }
90-
/** Return the number of blocks in a budget cycle */
91-
int GetBudgetCycleBlocks() const { return nBudgetCycleBlocks; }
92-
int64_t GetProposalEstablishmentTime() const { return nProposalEstablishmentTime; }
9387

9488
CAmount GetMinColdStakingAmount() const { return nMinColdStakingAmount; }
9589

96-
/** Spork key and Masternode Handling **/
97-
std::string SporkPubKey() const { return strSporkPubKey; }
98-
std::string SporkPubKeyOld() const { return strSporkPubKeyOld; }
99-
int64_t NewSporkStart() const { return nEnforceNewSporkKey; }
100-
int64_t RejectOldSporkKey() const { return nRejectOldSporkKey; }
101-
std::string ObfuscationPoolDummyAddress() const { return strObfuscationPoolDummyAddress; }
102-
int64_t StartMasternodePayments() const { return nStartMasternodePayments; }
103-
int64_t Budget_Fee_Confirmations() const { return nBudget_Fee_Confirmations; }
104-
10590
CBaseChainParams::Network NetworkID() const { return networkID; }
10691
bool IsRegTestNet() const { return NetworkID() == CBaseChainParams::REGTEST; }
10792

@@ -129,7 +114,6 @@ class CChainParams
129114
int nToCheckBlockUpgradeMajority;
130115
int64_t nPivxBadBlockTime;
131116
unsigned int nPivxBadBlocknBits;
132-
int nMasternodeCountDrift;
133117
int nMaturity;
134118

135119
int nMinerThreads;
@@ -142,18 +126,9 @@ class CChainParams
142126
bool fSkipProofOfWorkCheck;
143127
bool fTestnetToBeDeprecatedFieldRPC;
144128
bool fHeadersFirstSyncingActive;
145-
int nPoolMaxTransactions;
146-
int nBudgetCycleBlocks;
147-
std::string strSporkPubKey;
148-
std::string strSporkPubKeyOld;
149-
int64_t nEnforceNewSporkKey;
150-
int64_t nRejectOldSporkKey;
151-
std::string strObfuscationPoolDummyAddress;
152-
int64_t nStartMasternodePayments;
129+
153130

154131
CAmount nInvalidAmountFiltered;
155-
int64_t nBudget_Fee_Confirmations;
156-
int64_t nProposalEstablishmentTime;
157132

158133
CAmount nMinColdStakingAmount;
159134
};

src/consensus/params.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,28 @@ struct Params {
2323
uint256 powLimit;
2424
uint256 posLimitV1;
2525
uint256 posLimitV2;
26+
int nBudgetCycleBlocks;
27+
int nBudgetFeeConfirmations;
2628
int nCoinbaseMaturity;
2729
int nFutureTimeDriftPoW;
2830
int nFutureTimeDriftPoS;
31+
int nMasternodeCountDrift;
2932
CAmount nMaxMoneyOut;
33+
int nPoolMaxTransactions;
34+
int64_t nProposalEstablishmentTime;
3035
int nStakeMinAge;
3136
int nStakeMinDepth;
3237
int64_t nTargetTimespan;
3338
int64_t nTargetTimespanV2;
3439
int64_t nTargetSpacing;
3540
int nTimeSlotLength;
41+
std::string strObfuscationPoolDummyAddress;
42+
43+
// spork keys
44+
std::string strSporkPubKey;
45+
std::string strSporkPubKeyOld;
46+
int64_t nTime_EnforceNewSporkKey;
47+
int64_t nTime_RejectOldSporkKey;
3648

3749
// height-based activations
3850
int height_last_PoW;

src/main.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,9 +1644,6 @@ CAmount GetSeeSaw(const CAmount& blockValue, int nMasternodeCount, int nHeight)
16441644
int64_t nMoneySupply = chainActive.Tip()->nMoneySupply;
16451645
int64_t mNodeCoins = nMasternodeCount * 10000 * COIN;
16461646

1647-
// Use this log to compare the masternode count for different clients
1648-
//LogPrintf("Adjusting seesaw at height %d with %d masternodes (without drift: %d) at %ld\n", nHeight, nMasternodeCount, nMasternodeCount - Params().MasternodeCountDrift(), GetTime());
1649-
16501647
if (fDebug)
16511648
LogPrintf("GetMasternodePayment(): moneysupply=%s, nodecoins=%s \n", FormatMoney(nMoneySupply).c_str(),
16521649
FormatMoney(mNodeCoins).c_str());

0 commit comments

Comments
 (0)