Skip to content

Commit a836e21

Browse files
committed
v1.1.0.5
Coinswap preparations
1 parent 7a91adb commit a836e21

File tree

8 files changed

+86
-18
lines changed

8 files changed

+86
-18
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.4
3+
VERSION = 1.1.0.5
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 4
12+
#define CLIENT_VERSION_BUILD 5
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: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,20 @@ bool IsMNCollateralValid(int64_t value, int nHeight) {
120120
if (value == (mntier.second)*COIN)
121121
return true;
122122
}
123-
} else {
123+
} else if (nHeight < TIER_SWITCH) {
124124
// Using BOOST_FOREACH for concistency with the rest of the code, everything should be using a plain for from c++ 11 or 17
125125
BOOST_FOREACH(PAIRTYPE(const int, int)& mntier, masternodeTiers157000)
126126
{
127127
if (value == (mntier.second)*COIN)
128128
return true;
129129
}
130+
} else {
131+
// Using BOOST_FOREACH for concistency with the rest of the code, everything should be using a plain for from c++ 11 or 17
132+
BOOST_FOREACH(PAIRTYPE(const int, int)& mntier, masternodeTiersLast)
133+
{
134+
if (value == (mntier.second)*COIN)
135+
return true;
136+
}
130137
}
131138
return false;
132139
}
@@ -136,8 +143,10 @@ int64_t GetMNCollateral(int nHeight, int tier) {
136143
return 5000;
137144
} else if (nHeight < 157000) {
138145
return masternodeTiers[tier];
139-
} else {
146+
} else if (nHeight < TIER_SWITCH) {
140147
return masternodeTiers157000[tier];
148+
} else {
149+
return masternodeTiersLast[tier];
141150
}
142151
}
143152

@@ -1433,7 +1442,7 @@ bool IsPOSRewardValid(int64_t value, int64_t nFees) {
14331442
return true;
14341443
}
14351444
}
1436-
else {
1445+
else if (nHeight < TIER_SWITCH) {
14371446
// Using BOOST_FOREACH for concistency with the rest of the code
14381447
BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewards242600)
14391448
{
@@ -1445,6 +1454,18 @@ bool IsPOSRewardValid(int64_t value, int64_t nFees) {
14451454
return true;
14461455
}
14471456
}
1457+
else {
1458+
// Using BOOST_FOREACH for concistency with the rest of the code
1459+
BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewardsLast)
1460+
{
1461+
if (value == (tier.second*COIN + POS_REWARD_TIERED_MN*COIN + nFees))
1462+
return true;
1463+
}
1464+
// The case of a wallet staking with no mns up
1465+
if (value == POS_REWARD_TIERED_MN*COIN + nFees) {
1466+
return true;
1467+
}
1468+
}
14481469
}
14491470
return false;
14501471
}

src/main.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static const int64_t STATIC_POS_REWARD = 25 * COIN;
2727
static const int64_t TARGET_SPACING = 120;
2828
static const int64_t TARGET_SPACING_NEW = 60;
2929
static const int64_t FORK_TIME = 1521104400; //March 15th, 2018
30+
static const int64_t TIER_SWITCH = 268500;
3031

3132

3233
#define INSTANTX_SIGNATURES_REQUIRED 10

src/masternode.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void CMasternode::Check()
228228
}
229229
}
230230
}
231-
} else if (tier >= 0) {
231+
} else if (tier >= 0 && pindexBest->nHeight < TIER_SWITCH) {
232232
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers157000)
233233
{
234234
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
@@ -251,6 +251,29 @@ void CMasternode::Check()
251251
}
252252
}
253253
}
254+
} else if (tier >= 0) {
255+
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiersLast)
256+
{
257+
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
258+
CTransaction tx = CTransaction();
259+
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN,
260+
darkSendPool.collateralPubKey);
261+
tx.vin.push_back(vin);
262+
tx.vout.push_back(vout);
263+
{
264+
TRY_LOCK(cs_main, lockMain);
265+
if (!lockMain) return;
266+
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
267+
if (fAcceptable) { // Update mn tier on our records
268+
tier = (mntier.first);
269+
}
270+
else {
271+
tx.vin.pop_back();
272+
tx.vout.pop_back();
273+
}
274+
}
275+
}
276+
}
254277
}
255278
if (!fAcceptable) {
256279
activeState = MASTERNODE_VIN_SPENT;

src/masternode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ 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
5252
static std::map<int, int> masternodeTiers157000 = map_list_of (1, 10000) (2, 20000) (3, 30000); // 10000 - 20000 - 30000
53+
static std::map<int, int> masternodeTiersLast = map_list_of (1, 10000); // 10000
5354

5455
// Masternode tier rewards
5556
static std::map<int, int> masternodeTierRewards = map_list_of (1, 25) (2, 60) (3, 140) (4, 300); // 25 - 60 - 140 - 300
5657
static std::map<int, int> masternodeTierRewards157000 = map_list_of (1, 100) (2, 210) (3, 300); // 100 - 210 - 300
5758
static std::map<int, int> masternodeTierRewards242600 = map_list_of (1, 50) (2, 105) (3, 150); // 50 - 105 - 150
59+
static std::map<int, int> masternodeTierRewardsLast = map_list_of (1, 10); // 50 - 105 - 150
5860

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

src/masternodeman.cpp

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
847847
}
848848
}
849849
}
850-
} else if (pmn==NULL || pmn->tier >= 0) {
850+
} else if ((pmn==NULL || pmn->tier >= 0) && pindexBest->nHeight < TIER_SWITCH) {
851851
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers157000)
852852
{
853853
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
@@ -878,18 +878,35 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
878878
}
879879

880880
else {
881-
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, pmn->tier)) * COIN,
882-
darkSendPool.collateralPubKey);
883-
tx.vin.push_back(vin);
884-
tx.vout.push_back(vout);
881+
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiersLast)
885882
{
886-
TRY_LOCK(cs_main, lockMain);
887-
if (!lockMain) return;
888-
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
883+
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
884+
CTransaction tx = CTransaction();
885+
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN,
886+
darkSendPool.collateralPubKey);
887+
tx.vin.push_back(vin);
888+
tx.vout.push_back(vout);
889+
{
890+
TRY_LOCK(cs_main, lockMain);
891+
if (!lockMain) return;
892+
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
893+
if (fAcceptable) { // Update mn tier on our records
894+
if (pmn != NULL) {
895+
pmn->UpdateTier(mntier.first);
896+
}
897+
else {
898+
newMNTier = mntier.first;
899+
}
900+
}
901+
else {
902+
tx.vin.pop_back();
903+
tx.vout.pop_back();
904+
}
905+
}
906+
}
889907
}
890908
}
891909

892-
893910
if(fAcceptable){
894911
LogPrintf("dsee - Accepted masternode entry %i %i\n", count, current);
895912

src/wallet.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3601,9 +3601,11 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
36013601
masternodePayment = masternodeTierRewards[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards[tier])));
36023602
else if (pindexPrev->nHeight+1 < 242600)
36033603
masternodePayment = masternodeTierRewards157000[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards157000[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards157000[tier])));
3604-
else
3604+
else if (pindexPrev->nHeight+1 < TIER_SWITCH)
36053605
masternodePayment = masternodeTierRewards242600[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards242600[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards242600[tier])));
3606-
}
3606+
else
3607+
masternodePayment = masternodeTierRewardsLast[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewardsLast[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewardsLast[tier])));
3608+
}
36073609
else {
36083610
masternodePayment = 0;
36093611
}
@@ -3615,8 +3617,10 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
36153617
nCredit += masternodeTierRewards[tier]*COIN;
36163618
else if (pindexPrev->nHeight+1 < 242600)
36173619
nCredit += masternodeTierRewards157000[tier]*COIN;
3618-
else
3620+
else if (pindexPrev->nHeight+1 < TIER_SWITCH)
36193621
nCredit += masternodeTierRewards242600[tier]*COIN;
3622+
else
3623+
nCredit += masternodeTierRewardsLast[tier]*COIN;
36203624
LogPrintf("nCredit mn: %i\n", nCredit);
36213625
}
36223626
}

0 commit comments

Comments
 (0)