Skip to content

Commit 20fdb22

Browse files
committed
v1.1.0.2
New tiers and reward
1 parent 10a18e2 commit 20fdb22

File tree

7 files changed

+101
-9
lines changed

7 files changed

+101
-9
lines changed

cropcoin-qt.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
TEMPLATE = app
22
TARGET = cropcoin-qt
3-
VERSION = 1.1.0.1
3+
VERSION = 1.1.0.2
44
INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor
55
QT += network printsupport
66
DEFINES += ENABLE_WALLET

src/clientversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define CLIENT_VERSION_MAJOR 1
1010
#define CLIENT_VERSION_MINOR 1
1111
#define CLIENT_VERSION_REVISION 0
12-
#define CLIENT_VERSION_BUILD 1
12+
#define CLIENT_VERSION_BUILD 2
1313

1414
// Set to true for release, false for prerelease or test build
1515
#define CLIENT_VERSION_IS_RELEASE true

src/main.cpp

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,22 +113,31 @@ struct CMainSignals {
113113
bool IsMNCollateralValid(int64_t value, int nHeight) {
114114
if (nHeight < TIERED_MASTERNODES_START_BLOCK) {
115115
return value == 5000*COIN;
116-
} else {
116+
} else if (nHeight < 157000) {
117117
// Using BOOST_FOREACH for concistency with the rest of the code, everything should be using a plain for from c++ 11 or 17
118118
BOOST_FOREACH(PAIRTYPE(const int, int)& mntier, masternodeTiers)
119119
{
120120
if (value == (mntier.second)*COIN)
121121
return true;
122122
}
123+
} else {
124+
// Using BOOST_FOREACH for concistency with the rest of the code, everything should be using a plain for from c++ 11 or 17
125+
BOOST_FOREACH(PAIRTYPE(const int, int)& mntier, masternodeTiers157000)
126+
{
127+
if (value == (mntier.second)*COIN)
128+
return true;
129+
}
123130
}
124131
return false;
125132
}
126133

127134
int64_t GetMNCollateral(int nHeight, int tier) {
128135
if (nHeight < TIERED_MASTERNODES_START_BLOCK) {
129136
return 5000;
130-
} else {
137+
} else if (nHeight < 157000) {
131138
return masternodeTiers[tier];
139+
} else {
140+
return masternodeTiers157000[tier];
132141
}
133142
}
134143

@@ -1400,7 +1409,7 @@ bool IsPOSRewardValid(int64_t value, int64_t nFees) {
14001409
if (nHeight < TIERED_MASTERNODES_START_BLOCK) {
14011410
return value == (120*COIN + nFees);
14021411
}
1403-
else {
1412+
else if (nHeight < 157000 ) {
14041413
// Using BOOST_FOREACH for concistency with the rest of the code
14051414
BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewards)
14061415
{
@@ -1412,6 +1421,30 @@ bool IsPOSRewardValid(int64_t value, int64_t nFees) {
14121421
return true;
14131422
}
14141423
}
1424+
else if (nHeight < 242600) {
1425+
// Using BOOST_FOREACH for concistency with the rest of the code
1426+
BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewards157000)
1427+
{
1428+
if (value == (tier.second*COIN + POS_REWARD_TIERED_MN*COIN + nFees))
1429+
return true;
1430+
}
1431+
// The case of a wallet staking with no mns up
1432+
if (value == POS_REWARD_TIERED_MN*COIN + nFees) {
1433+
return true;
1434+
}
1435+
}
1436+
else {
1437+
// Using BOOST_FOREACH for concistency with the rest of the code
1438+
BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewards242600)
1439+
{
1440+
if (value == (tier.second*COIN + POS_REWARD_TIERED_MN*COIN + nFees))
1441+
return true;
1442+
}
1443+
// The case of a wallet staking with no mns up
1444+
if (value == POS_REWARD_TIERED_MN*COIN + nFees) {
1445+
return true;
1446+
}
1447+
}
14151448
}
14161449
return false;
14171450
}

src/masternode.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void CMasternode::Check()
205205
CTransaction tx = CTransaction();
206206
GetTransaction(vin.prevout.hash, tx, hashBlock);
207207
int64_t checkValue = tx.vout[vin.prevout.n].nValue;
208-
if (tier >= 0) {
208+
if (tier >= 0 && pindexBest->nHeight < 157000) {
209209
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers)
210210
{
211211
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
@@ -228,8 +228,30 @@ void CMasternode::Check()
228228
}
229229
}
230230
}
231+
} else if (tier >= 0) {
232+
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers157000)
233+
{
234+
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
235+
CTransaction tx = CTransaction();
236+
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN,
237+
darkSendPool.collateralPubKey);
238+
tx.vin.push_back(vin);
239+
tx.vout.push_back(vout);
240+
{
241+
TRY_LOCK(cs_main, lockMain);
242+
if (!lockMain) return;
243+
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
244+
if (fAcceptable) { // Update mn tier on our records
245+
tier = (mntier.first);
246+
}
247+
else {
248+
tx.vin.pop_back();
249+
tx.vout.pop_back();
250+
}
251+
}
252+
}
253+
}
231254
}
232-
233255
if (!fAcceptable) {
234256
activeState = MASTERNODE_VIN_SPENT;
235257
return;

src/masternode.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ bool GetBlockHash(uint256& hash, int nBlockHeight);
4949
typedef std::map<int, int> intMap;
5050
// Masternode tiers
5151
static std::map<int, int> masternodeTiers = map_list_of (1, 2500) (2, 5000) (3, 10000) (4, 20000); // 2500 - 5000 - 10000 - 20000
52+
static std::map<int, int> masternodeTiers157000 = map_list_of (1, 10000) (2, 20000) (3, 30000); // 10000 - 20000 - 30000
5253

5354
// Masternode tier rewards
5455
static std::map<int, int> masternodeTierRewards = map_list_of (1, 25) (2, 60) (3, 140) (4, 300); // 25 - 60 - 140 - 300
56+
static std::map<int, int> masternodeTierRewards157000 = map_list_of (1, 100) (2, 210) (3, 300); // 100 - 210 - 300
57+
static std::map<int, int> masternodeTierRewards242600 = map_list_of (1, 50) (2, 105) (3, 150); // 50 - 105 - 150
5558

5659
//
5760
// The Masternode Class. For managing the darksend process. It contains the input of the 1000 CROP, signature to prove

src/masternodeman.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,35 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
819819
GetTransaction(vin.prevout.hash, tx, hashBlock);
820820
int64_t checkValue = tx.vout[vin.prevout.n].nValue;
821821
int newMNTier = 0;
822-
if (pmn==NULL || pmn->tier >= 0) {
822+
if ((pmn==NULL || pmn->tier >= 0) && pindexBest->nHeight < 157000) {
823+
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers)
824+
{
825+
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
826+
CTransaction tx = CTransaction();
827+
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN,
828+
darkSendPool.collateralPubKey);
829+
tx.vin.push_back(vin);
830+
tx.vout.push_back(vout);
831+
{
832+
TRY_LOCK(cs_main, lockMain);
833+
if (!lockMain) return;
834+
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
835+
if (fAcceptable) { // Update mn tier on our records
836+
if (pmn != NULL) {
837+
pmn->UpdateTier(mntier.first);
838+
}
839+
else {
840+
newMNTier = mntier.first;
841+
}
842+
}
843+
else {
844+
tx.vin.pop_back();
845+
tx.vout.pop_back();
846+
}
847+
}
848+
}
849+
}
850+
} else if (pmn==NULL || pmn->tier >= 0) {
823851
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers)
824852
{
825853
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
@@ -848,6 +876,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
848876
}
849877
}
850878
}
879+
851880
else {
852881
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, pmn->tier)) * COIN,
853882
darkSendPool.collateralPubKey);

src/wallet.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3597,7 +3597,12 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
35973597
// after block TIERED_MASTERNODES_START_BLOCK we start with the tiered masternodes logic
35983598
if (pindexPrev->nHeight+1 >= TIERED_MASTERNODES_START_BLOCK) {
35993599
if (tier != 0) {
3600-
masternodePayment = masternodeTierRewards[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards[tier])));
3600+
if (pindexPrev->nHeight+1 < 157000)
3601+
masternodePayment = masternodeTierRewards[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards[tier])));
3602+
else if (pindexPrev->nHeight+1 < 242600)
3603+
masternodePayment = masternodeTierRewards157000[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards157000[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards157000[tier])));
3604+
else
3605+
masternodePayment = masternodeTierRewards242600[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards242600[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards242600[tier])));
36013606
}
36023607
else {
36033608
masternodePayment = 0;

0 commit comments

Comments
 (0)