1616#include " sync.h"
1717#include " Logging.h"
1818#include " utilmoneystr.h"
19+ #include " utilstrencodings.h"
1920#include " netfulfilledman.h"
2021#include < boost/filesystem.hpp>
2122#include < boost/lexical_cast.hpp>
@@ -349,9 +350,7 @@ bool CMasternodePayments::CheckMasternodeWinnerValidity(const CMasternodePayment
349350 /* Make sure that the payee is in our own payment queue near the top. */
350351 const std::vector<CMasternode*> mnQueue = GetMasternodePaymentQueue (seedHash, winner.GetHeight ());
351352 for (int i = 0 ; i < std::min<int >(2 * MNPAYMENTS_SIGNATURES_TOTAL, mnQueue.size ()); ++i) {
352- const auto & mn = *mnQueue[i];
353- const CScript mnPayee = GetScriptForDestination (mn.pubKeyCollateralAddress .GetID ());
354- if (mnPayee == winner.payee )
353+ if (winner.payee == mnQueue[i]->GetPaymentScript ())
355354 return true ;
356355 }
357356 return false ;
@@ -456,21 +455,31 @@ std::string CMasternodeBlockPayees::GetRequiredPaymentsString() const
456455{
457456 LOCK (cs_vecPayments);
458457
459- std::string ret = " Unknown" ;
458+ std::ostringstream ret;
459+ bool found = false ;
460460
461461 for (const auto & payee : vecPayments) {
462- CTxDestination address1;
463- ExtractDestination (payee.scriptPubKey , address1);
464- CBitcoinAddress address2 (address1);
462+ std::string thisPayee;
465463
466- if (ret != " Unknown" ) {
467- ret += " , " + address2.ToString () + " :" + boost::lexical_cast<std::string>(payee.nVotes );
464+ CTxDestination address1;
465+ if (ExtractDestination (payee.scriptPubKey , address1)) {
466+ const CBitcoinAddress address2 (address1);
467+ thisPayee = address2.ToString ();
468468 } else {
469- ret = address2. ToString () + " : " + boost::lexical_cast<std::string>( payee.nVotes );
469+ thisPayee = HexStr ( payee.scriptPubKey );
470470 }
471+
472+ if (found)
473+ ret << " , " ;
474+
475+ found = true ;
476+ ret << thisPayee << " :" << payee.nVotes ;
471477 }
472478
473- return ret;
479+ if (!found)
480+ return " Unknown" ;
481+
482+ return ret.str ();
474483}
475484
476485std::string CMasternodePayments::GetRequiredPaymentsString (const uint256& seedHash) const
@@ -554,7 +563,6 @@ unsigned CMasternodePayments::FindLastPayeePaymentTime(const CMasternode& master
554563 const CBlockIndex* chainTip = activeChain_.Tip ();
555564 if (chainTip == NULL ) return 0u ;
556565
557- CScript mnPayee = GetScriptForDestination (masternode.pubKeyCollateralAddress .GetID ());
558566 unsigned n = 0 ;
559567 for (unsigned int i = 1 ; chainTip && chainTip->nHeight > 0 ; i++) {
560568 if (n >= maxBlockDepth) {
@@ -572,7 +580,7 @@ unsigned CMasternodePayments::FindLastPayeePaymentTime(const CMasternode& master
572580 Search for this payee, with at least 2 votes. This will aid in consensus allowing the network
573581 to converge on the same payees quickly, then keep the same schedule.
574582 */
575- if (masternodePayees->HasPayeeWithVotes (mnPayee , 2 )) {
583+ if (masternodePayees->HasPayeeWithVotes (masternode. GetPaymentScript () , 2 )) {
576584 return chainTip->nTime + masternode.DeterministicTimeOffset ();
577585 }
578586 }
@@ -626,7 +634,7 @@ void ComputeMasternodesAndScores(
626634 // proper testing with a very small number of masternodes (which would
627635 // be scheduled and skipped all the time).
628636 if (Params ().NetworkID () != CBaseChainParams::REGTEST) {
629- if (masternodePayments.IsScheduled (GetScriptForDestination ( mn.pubKeyCollateralAddress . GetID () ), nBlockHeight)) continue ;
637+ if (masternodePayments.IsScheduled (mn.GetPaymentScript ( ), nBlockHeight)) continue ;
630638 }
631639
632640 // it's too new, wait for a cycle
0 commit comments