Skip to content

Commit

Permalink
[Consensus] set placeholder for nPublicZCSpendsV4
Browse files Browse the repository at this point in the history
sets temporarily the activation height for zerocoin public spends v4. Also defines an helper function Zerocoin_PublicSpendVersion which returns the version active at a given block height
  • Loading branch information
random-zebra committed Oct 21, 2019
1 parent e346308 commit 5a2ab57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ bool CChainParams::HasStakeMinAgeOrDepth(const int contextHeight, const uint32_t
return (contextHeight - utxoFromBlockHeight >= nStakeMinDepth);
}

int CChainParams::Zerocoin_PublicSpendVersion(const int nHeight) const
{
if (nHeight < nPublicZCSpendsV4)
return 3;
return 4;
}

class CMainParams : public CChainParams
{
public:
Expand Down Expand Up @@ -182,6 +189,7 @@ class CMainParams : public CChainParams
nBlockStakeModifierlV2 = 1967000;
// Public coin spend enforcement
nPublicZCSpends = 1880000;
nPublicZCSpendsV4 = 2880000;

// New P2P messages signatures
nBlockEnforceNewMessageSignatures = 2967000;
Expand Down Expand Up @@ -320,6 +328,7 @@ class CTestNetParams : public CMainParams
nBlockStakeModifierlV2 = 1214000;
// Public coin spend enforcement
nPublicZCSpends = 1106100;
nPublicZCSpendsV4 = 2106100;

// New P2P messages signatures
nBlockEnforceNewMessageSignatures = 2214000;
Expand Down Expand Up @@ -416,6 +425,7 @@ class CRegTestParams : public CTestNetParams
nBlockStakeModifierlV2 = std::numeric_limits<int>::max(); // max integer value (never switch on regtest)
// Public coin spend enforcement
nPublicZCSpends = 350;
nPublicZCSpendsV4 = 450;

// New P2P messages signatures
nBlockEnforceNewMessageSignatures = 1;
Expand Down
2 changes: 2 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class CChainParams
int Zerocoin_Block_V2_Start() const { return nBlockZerocoinV2; }
bool IsStakeModifierV2(const int nHeight) const { return nHeight >= nBlockStakeModifierlV2; }
int NewSigsActive(const int nHeight) const { return nHeight >= nBlockEnforceNewMessageSignatures; }
int Zerocoin_PublicSpendVersion(const int nHeight) const;

// fake serial attack
int Zerocoin_Block_EndFakeSerial() const { return nFakeSerialBlockheightEnd; }
Expand Down Expand Up @@ -223,6 +224,7 @@ class CChainParams
int nBlockZerocoinV2;
int nBlockDoubleAccumulated;
int nPublicZCSpends;
int nPublicZCSpendsV4;
int nBlockStakeModifierlV2;
int nBlockEnforceNewMessageSignatures;

Expand Down

0 comments on commit 5a2ab57

Please sign in to comment.