@@ -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);
0 commit comments