@@ -207,7 +207,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, const CBloc
207207 // No masternode detected, fall back to our own queue.
208208 const CMasternode* winningNode = mnodeman.GetNextMasternodeInQueueForPayment (pindexPrev, 1 , true );
209209 if (winningNode) {
210- payee = GetScriptForDestination ( winningNode->pubKeyCollateralAddress . GetID ()) ;
210+ payee = winningNode->rewardScript ;
211211 } else {
212212 LogPrint (" masternode" ," CreateNewBlock: Failed to detect masternode to pay\n " );
213213 hasPayment = false ;
@@ -364,15 +364,13 @@ bool CMasternodePayments::IsScheduled(const CMasternode& mn, int nNotBlockHeight
364364 if (tip == nullptr )
365365 return false ;
366366
367- const CScript mnpayee = GetScriptForDestination (mn.pubKeyCollateralAddress .GetID ());
368-
369367 for (int64_t h = 0 ; h <= 8 ; ++h) {
370368 if (tip->nHeight + h == nNotBlockHeight) continue ;
371369 uint256 seedHash;
372370 if (!GetBlockHashForScoring (seedHash, tip, h)) continue ;
373371 auto * payees = GetPayeesForScoreHash (seedHash);
374372 CScript payee;
375- if (payees != nullptr && payees->GetPayee (payee) && payee == mnpayee )
373+ if (payees != nullptr && payees->GetPayee (payee) && payee == mn. rewardScript )
376374 return true ;
377375 }
378376
@@ -461,21 +459,31 @@ std::string CMasternodeBlockPayees::GetRequiredPaymentsString() const
461459{
462460 LOCK (cs_vecPayments);
463461
464- std::string ret = " Unknown" ;
462+ std::ostringstream ret;
463+ bool found = false ;
465464
466465 for (const auto & payee : vecPayments) {
467- CTxDestination address1;
468- ExtractDestination (payee.scriptPubKey , address1);
469- CBitcoinAddress address2 (address1);
466+ std::string thisPayee;
470467
471- if (ret != " Unknown" ) {
472- ret += " , " + address2.ToString () + " :" + boost::lexical_cast<std::string>(payee.nVotes );
468+ CTxDestination address1;
469+ if (ExtractDestination (payee.scriptPubKey , address1)) {
470+ const CBitcoinAddress address2 (address1);
471+ thisPayee = address2.ToString ();
473472 } else {
474- ret = address2. ToString () + " : " + boost::lexical_cast<std::string>( payee.nVotes );
473+ thisPayee = HexStr ( payee.scriptPubKey );
475474 }
475+
476+ if (found)
477+ ret << " , " ;
478+
479+ found = true ;
480+ ret << thisPayee << " :" << payee.nVotes ;
476481 }
477482
478- return ret;
483+ if (!found)
484+ return " Unknown" ;
485+
486+ return ret.str ();
479487}
480488
481489std::string CMasternodePayments::GetRequiredPaymentsString (const uint256& seedHash) const
@@ -575,9 +583,7 @@ bool CMasternodePaymentWinner::IsValid(CNode* pnode, std::string& strError) cons
575583 /* Make sure that the payee is in our own payment queue near the top. */
576584 const std::vector<CMasternode*> mnQueue = mnodeman.GetMasternodePaymentQueue (seedHash, nBlockHeight, true );
577585 for (int i = 0 ; i < std::min<int >(2 * MNPAYMENTS_SIGNATURES_TOTAL, mnQueue.size ()); ++i) {
578- const auto & mn = *mnQueue[i];
579- const CScript mnPayee = GetScriptForDestination (mn.pubKeyCollateralAddress .GetID ());
580- if (mnPayee == payee)
586+ if (payee == mnQueue[i]->rewardScript )
581587 return true ;
582588 }
583589 return false ;
@@ -620,11 +626,13 @@ bool CMasternodePayments::ProcessBlock(const CBlockIndex* pindex, const int offs
620626 if (pmn != NULL ) {
621627 LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Found by FindOldestNotInVec \n " );
622628
623- const CTxDestination dest (pmn->pubKeyCollateralAddress .GetID ());
624- newWinner.AddPayee (GetScriptForDestination (dest));
629+ newWinner.AddPayee (pmn->rewardScript );
630+
631+ CTxDestination address1;
632+ ExtractDestination (pmn->rewardScript , address1);
633+ CBitcoinAddress address2 (address1);
625634
626- const CBitcoinAddress address (dest);
627- LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n " , address.ToString ().c_str (), newWinner.GetHeight ());
635+ LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Winner payee %s nHeight %d. \n " , address2.ToString ().c_str (), newWinner.GetHeight ());
628636 } else {
629637 LogPrint (" masternode" ," CMasternodePayments::ProcessBlock() Failed to find masternode to pay\n " );
630638 }
0 commit comments