diff --git a/cropcoin-qt.pro b/cropcoin-qt.pro index 5d17924..d8e0c0c 100644 --- a/cropcoin-qt.pro +++ b/cropcoin-qt.pro @@ -1,6 +1,6 @@ TEMPLATE = app TARGET = cropcoin-qt -VERSION = 1.1.0.4 +VERSION = 1.1.0.5 INCLUDEPATH += src src/json src/qt src/qt/plugins/mrichtexteditor QT += network printsupport DEFINES += ENABLE_WALLET diff --git a/src/clientversion.h b/src/clientversion.h index 6e83170..306dc28 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -9,7 +9,7 @@ #define CLIENT_VERSION_MAJOR 1 #define CLIENT_VERSION_MINOR 1 #define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 4 +#define CLIENT_VERSION_BUILD 5 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/main.cpp b/src/main.cpp index 1b03614..c2e677c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -120,13 +120,20 @@ bool IsMNCollateralValid(int64_t value, int nHeight) { if (value == (mntier.second)*COIN) return true; } - } else { + } else if (nHeight < TIER_SWITCH) { // Using BOOST_FOREACH for concistency with the rest of the code, everything should be using a plain for from c++ 11 or 17 BOOST_FOREACH(PAIRTYPE(const int, int)& mntier, masternodeTiers157000) { if (value == (mntier.second)*COIN) return true; } + } else { + // Using BOOST_FOREACH for concistency with the rest of the code, everything should be using a plain for from c++ 11 or 17 + BOOST_FOREACH(PAIRTYPE(const int, int)& mntier, masternodeTiersLast) + { + if (value == (mntier.second)*COIN) + return true; + } } return false; } @@ -136,8 +143,10 @@ int64_t GetMNCollateral(int nHeight, int tier) { return 5000; } else if (nHeight < 157000) { return masternodeTiers[tier]; - } else { + } else if (nHeight < TIER_SWITCH) { return masternodeTiers157000[tier]; + } else { + return masternodeTiersLast[tier]; } } @@ -1433,7 +1442,7 @@ bool IsPOSRewardValid(int64_t value, int64_t nFees) { return true; } } - else { + else if (nHeight < TIER_SWITCH) { // Using BOOST_FOREACH for concistency with the rest of the code BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewards242600) { @@ -1445,6 +1454,18 @@ bool IsPOSRewardValid(int64_t value, int64_t nFees) { return true; } } + else { + // Using BOOST_FOREACH for concistency with the rest of the code + BOOST_FOREACH(PAIRTYPE(const int, int)& tier, masternodeTierRewardsLast) + { + if (value == (tier.second*COIN + POS_REWARD_TIERED_MN*COIN + nFees)) + return true; + } + // The case of a wallet staking with no mns up + if (value == POS_REWARD_TIERED_MN*COIN + nFees) { + return true; + } + } } return false; } diff --git a/src/main.h b/src/main.h index 2eea465..a7c64b9 100644 --- a/src/main.h +++ b/src/main.h @@ -27,6 +27,7 @@ static const int64_t STATIC_POS_REWARD = 25 * COIN; static const int64_t TARGET_SPACING = 120; static const int64_t TARGET_SPACING_NEW = 60; static const int64_t FORK_TIME = 1521104400; //March 15th, 2018 +static const int64_t TIER_SWITCH = 268500; #define INSTANTX_SIGNATURES_REQUIRED 10 diff --git a/src/masternode.cpp b/src/masternode.cpp index 5844f4d..9f3714e 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -228,7 +228,7 @@ void CMasternode::Check() } } } - } else if (tier >= 0) { + } else if (tier >= 0 && pindexBest->nHeight < TIER_SWITCH) { BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers157000) { if (!fAcceptable && (mntier.second*COIN) == checkValue) { @@ -251,6 +251,29 @@ void CMasternode::Check() } } } + } else if (tier >= 0) { + BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiersLast) + { + if (!fAcceptable && (mntier.second*COIN) == checkValue) { + CTransaction tx = CTransaction(); + CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN, + darkSendPool.collateralPubKey); + tx.vin.push_back(vin); + tx.vout.push_back(vout); + { + TRY_LOCK(cs_main, lockMain); + if (!lockMain) return; + fAcceptable = AcceptableInputs(mempool, tx, false, NULL); + if (fAcceptable) { // Update mn tier on our records + tier = (mntier.first); + } + else { + tx.vin.pop_back(); + tx.vout.pop_back(); + } + } + } + } } if (!fAcceptable) { activeState = MASTERNODE_VIN_SPENT; diff --git a/src/masternode.h b/src/masternode.h index 532922d..95e13f4 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -50,11 +50,13 @@ typedef std::map intMap; // Masternode tiers static std::map masternodeTiers = map_list_of (1, 2500) (2, 5000) (3, 10000) (4, 20000); // 2500 - 5000 - 10000 - 20000 static std::map masternodeTiers157000 = map_list_of (1, 10000) (2, 20000) (3, 30000); // 10000 - 20000 - 30000 +static std::map masternodeTiersLast = map_list_of (1, 10000); // 10000 // Masternode tier rewards static std::map masternodeTierRewards = map_list_of (1, 25) (2, 60) (3, 140) (4, 300); // 25 - 60 - 140 - 300 static std::map masternodeTierRewards157000 = map_list_of (1, 100) (2, 210) (3, 300); // 100 - 210 - 300 static std::map masternodeTierRewards242600 = map_list_of (1, 50) (2, 105) (3, 150); // 50 - 105 - 150 +static std::map masternodeTierRewardsLast = map_list_of (1, 10); // 50 - 105 - 150 // // The Masternode Class. For managing the darksend process. It contains the input of the 1000 CROP, signature to prove diff --git a/src/masternodeman.cpp b/src/masternodeman.cpp index 2e28d3e..81fb216 100644 --- a/src/masternodeman.cpp +++ b/src/masternodeman.cpp @@ -847,7 +847,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData } } } - } else if (pmn==NULL || pmn->tier >= 0) { + } else if ((pmn==NULL || pmn->tier >= 0) && pindexBest->nHeight < TIER_SWITCH) { BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers157000) { if (!fAcceptable && (mntier.second*COIN) == checkValue) { @@ -878,18 +878,35 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData } else { - CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, pmn->tier)) * COIN, - darkSendPool.collateralPubKey); - tx.vin.push_back(vin); - tx.vout.push_back(vout); + BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiersLast) { - TRY_LOCK(cs_main, lockMain); - if (!lockMain) return; - fAcceptable = AcceptableInputs(mempool, tx, false, NULL); + if (!fAcceptable && (mntier.second*COIN) == checkValue) { + CTransaction tx = CTransaction(); + CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN, + darkSendPool.collateralPubKey); + tx.vin.push_back(vin); + tx.vout.push_back(vout); + { + TRY_LOCK(cs_main, lockMain); + if (!lockMain) return; + fAcceptable = AcceptableInputs(mempool, tx, false, NULL); + if (fAcceptable) { // Update mn tier on our records + if (pmn != NULL) { + pmn->UpdateTier(mntier.first); + } + else { + newMNTier = mntier.first; + } + } + else { + tx.vin.pop_back(); + tx.vout.pop_back(); + } + } + } } } - if(fAcceptable){ LogPrintf("dsee - Accepted masternode entry %i %i\n", count, current); diff --git a/src/wallet.cpp b/src/wallet.cpp index 908573d..e429f7a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -3601,9 +3601,11 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int masternodePayment = masternodeTierRewards[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards[tier]))); else if (pindexPrev->nHeight+1 < 242600) masternodePayment = masternodeTierRewards157000[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards157000[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards157000[tier]))); - else + else if (pindexPrev->nHeight+1 < TIER_SWITCH) masternodePayment = masternodeTierRewards242600[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewards242600[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewards242600[tier]))); - } + else + masternodePayment = masternodeTierRewardsLast[tier]*COIN + (int64_t) (nFees * ((double)masternodeTierRewardsLast[tier]/(POS_REWARD_TIERED_MN+masternodeTierRewardsLast[tier]))); + } else { masternodePayment = 0; } @@ -3615,8 +3617,10 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int nCredit += masternodeTierRewards[tier]*COIN; else if (pindexPrev->nHeight+1 < 242600) nCredit += masternodeTierRewards157000[tier]*COIN; - else + else if (pindexPrev->nHeight+1 < TIER_SWITCH) nCredit += masternodeTierRewards242600[tier]*COIN; + else + nCredit += masternodeTierRewardsLast[tier]*COIN; LogPrintf("nCredit mn: %i\n", nCredit); } }