Skip to content

Commit

Permalink
v1.1.0.5
Browse files Browse the repository at this point in the history
Coinswap preparations
  • Loading branch information
Cropdev committed Aug 22, 2018
1 parent 7a91adb commit a836e21
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 18 deletions.
2 changes: 1 addition & 1 deletion cropcoin-qt.pro
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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];
}
}

Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 24 additions & 1 deletion src/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/masternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ typedef std::map<int, int> intMap;
// Masternode tiers
static std::map<int, int> masternodeTiers = map_list_of (1, 2500) (2, 5000) (3, 10000) (4, 20000); // 2500 - 5000 - 10000 - 20000
static std::map<int, int> masternodeTiers157000 = map_list_of (1, 10000) (2, 20000) (3, 30000); // 10000 - 20000 - 30000
static std::map<int, int> masternodeTiersLast = map_list_of (1, 10000); // 10000

// Masternode tier rewards
static std::map<int, int> masternodeTierRewards = map_list_of (1, 25) (2, 60) (3, 140) (4, 300); // 25 - 60 - 140 - 300
static std::map<int, int> masternodeTierRewards157000 = map_list_of (1, 100) (2, 210) (3, 300); // 100 - 210 - 300
static std::map<int, int> masternodeTierRewards242600 = map_list_of (1, 50) (2, 105) (3, 150); // 50 - 105 - 150
static std::map<int, int> 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
Expand Down
35 changes: 26 additions & 9 deletions src/masternodeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down
10 changes: 7 additions & 3 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
}
}
Expand Down

0 comments on commit a836e21

Please sign in to comment.