Skip to content

Commit b0d3a61

Browse files
committed
v1.1.0.1
Tiered masternodes fix
1 parent 008a883 commit b0d3a61

File tree

6 files changed

+24
-26
lines changed

6 files changed

+24
-26
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.0
3+
VERSION = 1.1.0.1
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 0
12+
#define CLIENT_VERSION_BUILD 1
1313

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

src/masternode.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,15 @@ void CMasternode::Check()
201201
bool fAcceptable = false;
202202

203203
if(!unitTest) {
204+
uint256 hashBlock = 0;
204205
CTransaction tx = CTransaction();
205-
if (tier == 0) {
206+
GetTransaction(vin.prevout.hash, tx, hashBlock);
207+
int64_t checkValue = tx.vout[vin.prevout.n].nValue;
208+
if (tier >= 0) {
206209
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers)
207210
{
208-
if (!fAcceptable) {
211+
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
212+
CTransaction tx = CTransaction();
209213
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN,
210214
darkSendPool.collateralPubKey);
211215
tx.vin.push_back(vin);
@@ -225,17 +229,7 @@ void CMasternode::Check()
225229
}
226230
}
227231
}
228-
else {
229-
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, tier)) * COIN,
230-
darkSendPool.collateralPubKey);
231-
tx.vin.push_back(vin);
232-
tx.vout.push_back(vout);
233-
{
234-
TRY_LOCK(cs_main, lockMain);
235-
if (!lockMain) return;
236-
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
237-
}
238-
}
232+
239233
if (!fAcceptable) {
240234
activeState = MASTERNODE_VIN_SPENT;
241235
return;

src/masternodeman.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,16 +545,18 @@ CMasternode* CMasternodeMan::GetCurrentMasterNode(int mod, int64_t nBlockHeight,
545545
int64_t wLastPaid = winner->nLastPaid;
546546

547547
for(std::vector<CMasternode>::size_type i = 0; i != winningArea.size(); i++) {
548-
LogPrintf("Winner Vector: %i - %i\n", winningArea[i].score, winningArea[i].nLastPaid);
549548
if (now - winningArea[i].nLastPaid > avgRewardTime) {
550549
if (winningArea[i].nLastPaid < wLastPaid) {
551550
winner = &(winningArea[i]);
552551
wLastPaid = winner->nLastPaid;
553552
}
554553
}
555554
}
556-
557-
LogPrintf("Winner MN: %i - %i\n", winner->score, winner->nLastPaid);
555+
BOOST_FOREACH(CMasternode& mn, vMasternodes) {
556+
if (mn.vin == winner->vin) {
557+
return &mn;
558+
}
559+
}
558560
return winner;
559561
}
560562

@@ -812,13 +814,16 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
812814

813815
bool fAcceptable = false;
814816

817+
uint256 hashBlock = 0;
815818
CTransaction tx = CTransaction();
819+
GetTransaction(vin.prevout.hash, tx, hashBlock);
820+
int64_t checkValue = tx.vout[vin.prevout.n].nValue;
816821
int newMNTier = 0;
817-
if (pmn==NULL || pmn->tier == 0) {
822+
if (pmn==NULL || pmn->tier >= 0) {
818823
BOOST_FOREACH(PAIRTYPE(const int, int) & mntier, masternodeTiers)
819824
{
820-
if (!fAcceptable) {
821-
//LogPrintf("MasternodeMan: Looking for acceptable inputs for tier %i\n",mntier.first);
825+
if (!fAcceptable && (mntier.second*COIN) == checkValue) {
826+
CTransaction tx = CTransaction();
822827
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, mntier.first)) * COIN,
823828
darkSendPool.collateralPubKey);
824829
tx.vin.push_back(vin);
@@ -829,7 +834,6 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
829834
fAcceptable = AcceptableInputs(mempool, tx, false, NULL);
830835
if (fAcceptable) { // Update mn tier on our records
831836
if (pmn != NULL) {
832-
LogPrintf("MasternodeMan: Changing masternode tier\n");
833837
pmn->UpdateTier(mntier.first);
834838
}
835839
else {
@@ -845,7 +849,6 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
845849
}
846850
}
847851
else {
848-
LogPrintf("dsee - ProcessMessage 17\n");
849852
CTxOut vout = CTxOut((GetMNCollateral(pindexBest->nHeight, pmn->tier)) * COIN,
850853
darkSendPool.collateralPubKey);
851854
tx.vin.push_back(vin);

src/qt/masternodemanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void MasternodeManager::copyPubkey()
359359
{
360360
QModelIndex index = selectedRows.at(i);
361361
row = index.row();
362-
sData += ui->tableWidgetMasternodes->item(row, 5)->text().toStdString();
362+
sData += ui->tableWidgetMasternodes->item(row, 6)->text().toStdString();
363363
if (i < selectedRows.count()-1)
364364
sData += "\n";
365365
}

src/wallet.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,11 +3522,12 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
35223522
int payeerewardpercent = 0;
35233523
CTxIn vin;
35243524
int tier = 0;
3525+
CMasternode* winningNode = NULL;
35253526
bool hasPayment = true;
35263527
if(bMasterNodePayment) {
35273528
//spork
35283529
if(!masternodePayments.GetBlockPayee(pindexPrev->nHeight+1, payee, vin)){
3529-
CMasternode* winningNode = mnodeman.GetCurrentMasterNode(1, pindexBest->nHeight);
3530+
winningNode = mnodeman.GetCurrentMasterNode(1, pindexBest->nHeight);
35303531
if(winningNode){
35313532
payee = GetScriptForDestination(winningNode->pubkey.GetID());
35323533
payeerewardaddress = winningNode->rewardAddress;
@@ -3538,7 +3539,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int
35383539
}
35393540
else {
35403541
// Only used after block TIERED_MASTERNODES_START_BLOCK
3541-
CMasternode* winningNode = mnodeman.Find(vin);
3542+
winningNode = mnodeman.Find(vin);
35423543
tier = winningNode->tier;
35433544
}
35443545
}

0 commit comments

Comments
 (0)