@@ -339,7 +339,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, const CBloc
339339 // No masternode detected, fall back to our own queue.
340340 const CMasternode* winningNode = mnodeman.GetNextMasternodeInQueueForPayment (pindexPrev, 1 , true );
341341 if (winningNode) {
342- payee = GetScriptForDestination ( winningNode->pubKeyCollateralAddress . GetID ()) ;
342+ payee = winningNode->rewardScript ;
343343 } else {
344344 LogPrint (" masternode" ," CreateNewBlock: Failed to detect masternode to pay\n " );
345345 hasPayment = false ;
@@ -496,15 +496,13 @@ bool CMasternodePayments::IsScheduled(const CMasternode& mn, int nNotBlockHeight
496496 if (tip == nullptr )
497497 return false ;
498498
499- const CScript mnpayee = GetScriptForDestination (mn.pubKeyCollateralAddress .GetID ());
500-
501499 for (int64_t h = 0 ; h <= 8 ; ++h) {
502500 if (tip->nHeight + h == nNotBlockHeight) continue ;
503501 uint256 seedHash;
504502 if (!GetBlockHashForScoring (seedHash, tip, h)) continue ;
505503 auto * payees = GetPayeesForScoreHash (seedHash);
506504 CScript payee;
507- if (payees != nullptr && payees->GetPayee (payee) && payee == mnpayee )
505+ if (payees != nullptr && payees->GetPayee (payee) && payee == mn. rewardScript )
508506 return true ;
509507 }
510508
@@ -591,21 +589,31 @@ std::string CMasternodeBlockPayees::GetRequiredPaymentsString() const
591589{
592590 LOCK (cs_vecPayments);
593591
594- std::string ret = " Unknown" ;
592+ std::ostringstream ret;
593+ bool found = false ;
595594
596595 for (const auto & payee : vecPayments) {
597- CTxDestination address1;
598- ExtractDestination (payee.scriptPubKey , address1);
599- CBitcoinAddress address2 (address1);
596+ std::string thisPayee;
600597
601- if (ret != " Unknown" ) {
602- ret += " , " + address2.ToString () + " :" + boost::lexical_cast<std::string>(payee.nVotes );
598+ CTxDestination address1;
599+ if (ExtractDestination (payee.scriptPubKey , address1)) {
600+ const CBitcoinAddress address2 (address1);
601+ thisPayee = address2.ToString ();
603602 } else {
604- ret = address2. ToString () + " : " + boost::lexical_cast<std::string>( payee.nVotes );
603+ thisPayee = HexStr ( payee.scriptPubKey );
605604 }
605+
606+ if (found)
607+ ret << " , " ;
608+
609+ found = true ;
610+ ret << thisPayee << " :" << payee.nVotes ;
606611 }
607612
608- return ret;
613+ if (!found)
614+ return " Unknown" ;
615+
616+ return ret.str ();
609617}
610618
611619std::string CMasternodePayments::GetRequiredPaymentsString (const uint256& seedHash) const
@@ -705,9 +713,7 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError) cons
705713 /* Make sure that the payee is in our own payment queue near the top. */
706714 const std::vector<CMasternode*> mnQueue = mnodeman.GetMasternodePaymentQueue (seedHash, nBlockHeight, true );
707715 for (int i = 0 ; i < std::min<int >(2 * MNPAYMENTS_SIGNATURES_TOTAL, mnQueue.size ()); ++i) {
708- const auto & mn = *mnQueue[i];
709- const CScript mnPayee = GetScriptForDestination (mn.pubKeyCollateralAddress .GetID ());
710- if (mnPayee == payee)
716+ if (payee == mnQueue[i]->rewardScript )
711717 return true ;
712718 }
713719 return false ;
@@ -750,11 +756,13 @@ bool CMasternodePayments::ProcessBlock(const CBlockIndex* pindex, const int offs
750756 if (pmn != NULL ) {
751757 LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Found by FindOldestNotInVec \n " );
752758
753- const CTxDestination dest (pmn->pubKeyCollateralAddress .GetID ());
754- newWinner.AddPayee (GetScriptForDestination (dest));
759+ newWinner.AddPayee (pmn->rewardScript );
760+
761+ CTxDestination address1;
762+ ExtractDestination (pmn->rewardScript , address1);
763+ CBitcoinAddress address2 (address1);
755764
756- const CBitcoinAddress address (dest);
757- LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n " , address.ToString ().c_str (), newWinner.GetHeight ());
765+ LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n " , address2.ToString ().c_str (), newWinner.GetHeight ());
758766 } else {
759767 LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Failed to find masternode to pay\n " );
760768 }
0 commit comments