fix masternode current
rpc (#1640)
GetNextMasternodeInQueueForPayment should not filter scheduled massternodes for it
This commit is contained in:
parent
8c15f5f878
commit
0c1679e58c
@ -272,7 +272,7 @@ void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int nBlockH
|
|||||||
// no masternode detected...
|
// no masternode detected...
|
||||||
int nCount = 0;
|
int nCount = 0;
|
||||||
masternode_info_t mnInfo;
|
masternode_info_t mnInfo;
|
||||||
if(!mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, nCount, mnInfo)) {
|
if(!mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, true, nCount, mnInfo)) {
|
||||||
// ...and we can't calculate it on our own
|
// ...and we can't calculate it on our own
|
||||||
LogPrintf("CMasternodePayments::FillBlockPayee -- Failed to detect masternode to pay\n");
|
LogPrintf("CMasternodePayments::FillBlockPayee -- Failed to detect masternode to pay\n");
|
||||||
return;
|
return;
|
||||||
@ -744,7 +744,7 @@ bool CMasternodePayments::ProcessBlock(int nBlockHeight, CConnman& connman)
|
|||||||
int nCount = 0;
|
int nCount = 0;
|
||||||
masternode_info_t mnInfo;
|
masternode_info_t mnInfo;
|
||||||
|
|
||||||
if (!mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, nCount, mnInfo)) {
|
if (!mnodeman.GetNextMasternodeInQueueForPayment(nBlockHeight, true, true, nCount, mnInfo)) {
|
||||||
LogPrintf("CMasternodePayments::ProcessBlock -- ERROR: Failed to find masternode to pay\n");
|
LogPrintf("CMasternodePayments::ProcessBlock -- ERROR: Failed to find masternode to pay\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -482,12 +482,12 @@ bool CMasternodeMan::Has(const COutPoint& outpoint)
|
|||||||
//
|
//
|
||||||
// Deterministically select the oldest/best masternode to pay on the network
|
// Deterministically select the oldest/best masternode to pay on the network
|
||||||
//
|
//
|
||||||
bool CMasternodeMan::GetNextMasternodeInQueueForPayment(bool fFilterSigTime, int& nCountRet, masternode_info_t& mnInfoRet)
|
bool CMasternodeMan::GetNextMasternodeInQueueForPayment(bool fFilterSigTime, bool fFilterScheduled, int& nCountRet, masternode_info_t& mnInfoRet)
|
||||||
{
|
{
|
||||||
return GetNextMasternodeInQueueForPayment(nCachedBlockHeight, fFilterSigTime, nCountRet, mnInfoRet);
|
return GetNextMasternodeInQueueForPayment(nCachedBlockHeight, fFilterSigTime, fFilterScheduled, nCountRet, mnInfoRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, int& nCountRet, masternode_info_t& mnInfoRet)
|
bool CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, bool fFilterScheduled, int& nCountRet, masternode_info_t& mnInfoRet)
|
||||||
{
|
{
|
||||||
mnInfoRet = masternode_info_t();
|
mnInfoRet = masternode_info_t();
|
||||||
nCountRet = 0;
|
nCountRet = 0;
|
||||||
@ -515,7 +515,7 @@ bool CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight, bool f
|
|||||||
if(mnpair.second.nProtocolVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
|
if(mnpair.second.nProtocolVersion < mnpayments.GetMinMasternodePaymentsProto()) continue;
|
||||||
|
|
||||||
//it's in the list (up to 8 entries ahead of current block to allow propagation) -- so let's skip it
|
//it's in the list (up to 8 entries ahead of current block to allow propagation) -- so let's skip it
|
||||||
if(mnpayments.IsScheduled(mnpair.second, nBlockHeight)) continue;
|
if(fFilterScheduled && mnpayments.IsScheduled(mnpair.second, nBlockHeight)) continue;
|
||||||
|
|
||||||
//it's too new, wait for a cycle
|
//it's too new, wait for a cycle
|
||||||
if(fFilterSigTime && mnpair.second.sigTime + (nMnCount*2.6*60) > GetAdjustedTime()) continue;
|
if(fFilterSigTime && mnpair.second.sigTime + (nMnCount*2.6*60) > GetAdjustedTime()) continue;
|
||||||
@ -530,7 +530,7 @@ bool CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight, bool f
|
|||||||
|
|
||||||
//when the network is in the process of upgrading, don't penalize nodes that recently restarted
|
//when the network is in the process of upgrading, don't penalize nodes that recently restarted
|
||||||
if(fFilterSigTime && nCountRet < nMnCount/3)
|
if(fFilterSigTime && nCountRet < nMnCount/3)
|
||||||
return GetNextMasternodeInQueueForPayment(nBlockHeight, false, nCountRet, mnInfoRet);
|
return GetNextMasternodeInQueueForPayment(nBlockHeight, false, fFilterScheduled, nCountRet, mnInfoRet);
|
||||||
|
|
||||||
// Sort them low to high
|
// Sort them low to high
|
||||||
sort(vecMasternodeLastPaid.begin(), vecMasternodeLastPaid.end(), CompareLastPaidBlock());
|
sort(vecMasternodeLastPaid.begin(), vecMasternodeLastPaid.end(), CompareLastPaidBlock());
|
||||||
|
@ -166,9 +166,9 @@ public:
|
|||||||
bool GetMasternodeInfo(const CScript& payee, masternode_info_t& mnInfoRet);
|
bool GetMasternodeInfo(const CScript& payee, masternode_info_t& mnInfoRet);
|
||||||
|
|
||||||
/// Find an entry in the masternode list that is next to be paid
|
/// Find an entry in the masternode list that is next to be paid
|
||||||
bool GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, int& nCountRet, masternode_info_t& mnInfoRet);
|
bool GetNextMasternodeInQueueForPayment(int nBlockHeight, bool fFilterSigTime, bool fFilterScheduled, int& nCountRet, masternode_info_t& mnInfoRet);
|
||||||
/// Same as above but use current block height
|
/// Same as above but use current block height
|
||||||
bool GetNextMasternodeInQueueForPayment(bool fFilterSigTime, int& nCountRet, masternode_info_t& mnInfoRet);
|
bool GetNextMasternodeInQueueForPayment(bool fFilterSigTime, bool fFilterScheduled, int& nCountRet, masternode_info_t& mnInfoRet);
|
||||||
|
|
||||||
/// Find a random entry
|
/// Find a random entry
|
||||||
masternode_info_t FindRandomNotInVec(const std::vector<COutPoint> &vecToExclude, int nProtocolVersion = -1);
|
masternode_info_t FindRandomNotInVec(const std::vector<COutPoint> &vecToExclude, int nProtocolVersion = -1);
|
||||||
|
@ -125,7 +125,7 @@ UniValue masternode(const UniValue& params, bool fHelp)
|
|||||||
" status - Print masternode status information\n"
|
" status - Print masternode status information\n"
|
||||||
" list - Print list of all known masternodes (see masternodelist for more info)\n"
|
" list - Print list of all known masternodes (see masternodelist for more info)\n"
|
||||||
" list-conf - Print masternode.conf in JSON format\n"
|
" list-conf - Print masternode.conf in JSON format\n"
|
||||||
" winner - Print info on next masternode winner to vote for\n"
|
" winner - Print info on next masternode winner to vote for (calculated locally)\n"
|
||||||
" winners - Print list of masternode winners\n"
|
" winners - Print list of masternode winners\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ UniValue masternode(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
int nCount;
|
int nCount;
|
||||||
masternode_info_t mnInfo;
|
masternode_info_t mnInfo;
|
||||||
mnodeman.GetNextMasternodeInQueueForPayment(true, nCount, mnInfo);
|
mnodeman.GetNextMasternodeInQueueForPayment(true, true, nCount, mnInfo);
|
||||||
|
|
||||||
if (strMode == "qualify")
|
if (strMode == "qualify")
|
||||||
return nCount;
|
return nCount;
|
||||||
@ -199,8 +199,7 @@ UniValue masternode(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
nHeight = pindex->nHeight + (strCommand == "current" ? 1 : 10);
|
nHeight = pindex->nHeight + (strCommand == "current" ? 1 : 10);
|
||||||
mnodeman.UpdateLastPaid(pindex);
|
mnodeman.UpdateLastPaid(pindex);
|
||||||
|
if (!mnodeman.GetNextMasternodeInQueueForPayment(nHeight, true, false, nCount, mnInfo))
|
||||||
if(!mnodeman.GetNextMasternodeInQueueForPayment(nHeight, true, nCount, mnInfo))
|
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
|
Loading…
Reference in New Issue
Block a user