Skip to content

Commit

Permalink
Merge pull request #101 from VitaeTeam/rel-4.6.0-fix
Browse files Browse the repository at this point in the history
Tied minimum stake age to spork & bumped protocols & versions for v4.6.2
  • Loading branch information
tohsnoom authored Mar 6, 2021
2 parents 9b14c34 + f6ce545 commit 375099f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 4)
define(_CLIENT_VERSION_MINOR, 6)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2020)
Expand Down
4 changes: 3 additions & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ static Checkpoints::MapCheckpoints mapCheckpoints =
(1529400,uint256("2e2f9fc719f478a532177f57c56345502539aeb37ba45b8147fbdf53f15f628f"))
(1540850,uint256("ad53c70beb0dde7fe7c291cbdc5382c29d011d946edf14adf8274db765213c48"))
(1594800,uint256("35d628c9471ff3d2b98d327a87b69669b219e5c473c0ccd54d6db84198b38819"))
(1797000,uint256("3222dfdda3b2c842eaff173e3a632964d56c3f5a957d0b444af2df07dd06754d"));
(1797000,uint256("3222dfdda3b2c842eaff173e3a632964d56c3f5a957d0b444af2df07dd06754d"))
(2000016,uint256("Fed89c61b9c7e19593c259344eb5d8a3121fd7f516d2cca31499a28f68af73b7"))
(2050000,uint256("6f89ed36393384b07325b96e54b59abdd8a1803b98b1ccaae14cc80c8912395e"));

static const Checkpoints::CCheckpointData data = {
&mapCheckpoints,
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! These need to be macros, as clientversion.cpp's and vitae*-res.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 4
#define CLIENT_VERSION_MINOR 6
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_REVISION 2
#define CLIENT_VERSION_BUILD 0

//! Set to true for release, false for prerelease or test build
Expand Down
2 changes: 1 addition & 1 deletion src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ bool CheckProofOfStake(const CBlock& block, uint256& hashProofOfStake, std::uniq
const int nHeightBlockFrom = pindexFrom->nHeight;
const uint32_t nTimeBlockFrom = pindexFrom->nTime;

if (!txin.IsZerocoinSpend()) {
if (!txin.IsZerocoinSpend() && ((nPreviousBlockHeight + 1) >= GetSporkValue(SPORK_26_MINIMUM_STAKE_AGE_BLOCK))) {
if(! Params().HasStakeMinAgeOrDepth(nPreviousBlockHeight + 1, block.nTime, nHeightBlockFrom, nTimeBlockFrom, getStakeModifierV2SporkValue()))
return error("%s : min age violation - height=%d - time=%d, nHeightBlockFrom=%d, nTimeBlockFrom=%d",
__func__, nPreviousBlockHeight + 1, block.nTime, nHeightBlockFrom, nTimeBlockFrom);
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,7 @@ CAmount GetSeeSaw(int nHeight, int64_t blockValue){
int nMasternodeCount = 0 ;

//if a mn count is inserted into the function we are looking for a specific result for a masternode count
if (IsSporkActive(SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6))
if (IsSporkActive(SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7))
nMasternodeCount = m_nodeman.CountMasternodesAboveProtocol(MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT);
else
nMasternodeCount = m_nodeman.CountMasternodesAboveProtocol(MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT);
Expand Down Expand Up @@ -6733,7 +6733,7 @@ int ActiveProtocol()
// SPORK_25 is used for 71026. Nodes < 71026 won't see it and still get their protocol version via SPORK_14 and their
// own ModifierUpgradeBlock()

if (IsSporkActive(SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6))
if (IsSporkActive(SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7))
return MIN_PEER_PROTO_VERSION_AFTER_ENFORCEMENT;
return MIN_PEER_PROTO_VERSION_BEFORE_ENFORCEMENT;
}
Expand Down
6 changes: 6 additions & 0 deletions src/spork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ int64_t GetSporkValue(int nSporkID)
if (nSporkID == SPORK_23_TIME_PROTOCOL_V2_BLOCK) r = SPORK_23_TIME_PROTOCOL_V2_BLOCK_DEFAULT;
if (nSporkID == SPORK_24_STAKE_MODIFIER_V2_BLOCK) r = SPORK_24_STAKE_MODIFIER_V2_BLOCK_DEFAULT;
if (nSporkID == SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6) r = SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6_DEFAULT;
if (nSporkID == SPORK_26_MINIMUM_STAKE_AGE_BLOCK) r = SPORK_26_MINIMUM_STAKE_AGE_BLOCK_DEFAULT;
if (nSporkID == SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7) r = SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7_DEFAULT;

if (r == -1) LogPrintf("%s : Unknown Spork %d\n", __func__, nSporkID);
}
Expand Down Expand Up @@ -303,6 +305,8 @@ int CSporkManager::GetSporkIDByName(std::string strName)
if (strName == "SPORK_23_TIME_PROTOCOL_V2_BLOCK") return SPORK_23_TIME_PROTOCOL_V2_BLOCK;
if (strName == "SPORK_24_STAKE_MODIFIER_V2_BLOCK") return SPORK_24_STAKE_MODIFIER_V2_BLOCK;
if (strName == "SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6") return SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6;
if (strName == "SPORK_26_MINIMUM_STAKE_AGE_BLOCK") return SPORK_26_MINIMUM_STAKE_AGE_BLOCK;
if (strName == "SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7") return SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7;

return -1;
}
Expand All @@ -329,6 +333,8 @@ std::string CSporkManager::GetSporkNameByID(int id)
if (id == SPORK_23_TIME_PROTOCOL_V2_BLOCK) return "SPORK_23_TIME_PROTOCOL_V2_BLOCK";
if (id == SPORK_24_STAKE_MODIFIER_V2_BLOCK) return "SPORK_24_STAKE_MODIFIER_V2_BLOCK";
if (id == SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6) return "SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6";
if (id == SPORK_26_MINIMUM_STAKE_AGE_BLOCK) return "SPORK_26_MINIMUM_STAKE_AGE_BLOCK";
if (id == SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7) return "SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7";

return "Unknown";
}
6 changes: 5 additions & 1 deletion src/spork.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using namespace boost;
Sporks 11,12, and 16 to be removed with 1st zerocoin release
*/
#define SPORK_START 10001
#define SPORK_END 10024
#define SPORK_END 10026

#define SPORK_2_SWIFTTX 10001
#define SPORK_3_SWIFTTX_BLOCK_FILTERING 10002
Expand All @@ -53,6 +53,8 @@ using namespace boost;
#define SPORK_23_TIME_PROTOCOL_V2_BLOCK 10022
#define SPORK_24_STAKE_MODIFIER_V2_BLOCK 10023
#define SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6 10024
#define SPORK_26_MINIMUM_STAKE_AGE_BLOCK 10025
#define SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7 10026

#define SPORK_2_SWIFTTX_DEFAULT 978307200 //2001-1-1
#define SPORK_3_SWIFTTX_BLOCK_FILTERING_DEFAULT 1424217600 //2015-2-18
Expand All @@ -75,6 +77,8 @@ using namespace boost;
#define SPORK_23_TIME_PROTOCOL_V2_BLOCK_DEFAULT 9999999999 //OFF
#define SPORK_24_STAKE_MODIFIER_V2_BLOCK_DEFAULT 9999999999 //OFF
#define SPORK_25_NEW_PROTOCOL_ENFORCEMENT_6_DEFAULT 9999999999 //OFF
#define SPORK_26_MINIMUM_STAKE_AGE_BLOCK_DEFAULT 9999999999 //OFF
#define SPORK_27_NEW_PROTOCOL_ENFORCEMENT_7_DEFAULT 9999999999 //OFF

class CSporkMessage;
class CSporkManager;
Expand Down

0 comments on commit 375099f

Please sign in to comment.