drop -masternodeminprotocol/nMasternodeMinProtocol, use masternodePayments.GetMinMasternodePaymentsProto()

This commit is contained in:
UdjinM6 2015-07-20 08:03:36 +03:00
parent 5f9c676e05
commit 753297ea99
7 changed files with 7 additions and 14 deletions

View File

@ -415,7 +415,6 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += " -mnconflock=<n> " + strprintf(_("Lock masternodes from masternode configuration file (default: %u)"), 1) + "\n"; strUsage += " -mnconflock=<n> " + strprintf(_("Lock masternodes from masternode configuration file (default: %u)"), 1) + "\n";
strUsage += " -masternodeprivkey=<n> " + _("Set the masternode private key") + "\n"; strUsage += " -masternodeprivkey=<n> " + _("Set the masternode private key") + "\n";
strUsage += " -masternodeaddr=<n> " + _("Set external address:port to get to this masternode (example: address:port)") + "\n"; strUsage += " -masternodeaddr=<n> " + _("Set external address:port to get to this masternode (example: address:port)") + "\n";
strUsage += " -masternodeminprotocol=<n> " + strprintf(_("Ignore masternodes less than version (example: 70050; default: %u)"), masternodePayments.GetMinMasternodePaymentsProto()) + "\n";
strUsage += " -budgetvotemode=<mode> " + _("Change automatic finalized budget voting behavior. mode=auto: Vote for only exact finalized budget match to my generated budget. (string, default: auto)") + "\n"; strUsage += " -budgetvotemode=<mode> " + _("Change automatic finalized budget voting behavior. mode=auto: Vote for only exact finalized budget match to my generated budget. (string, default: auto)") + "\n";
strUsage += "\n" + _("Darksend options:") + "\n"; strUsage += "\n" + _("Darksend options:") + "\n";
@ -868,9 +867,6 @@ bool AppInit2(boost::thread_group& threadGroup)
return InitError(_("Unable to sign spork message, wrong key?")); return InitError(_("Unable to sign spork message, wrong key?"));
} }
//ignore masternodes below protocol version
nMasternodeMinProtocol = GetArg("-masternodeminprotocol", masternodePayments.GetMinMasternodePaymentsProto());
/* Start the RPC server already. It will be started in "warmup" mode /* Start the RPC server already. It will be started in "warmup" mode
* and not really process calls already (but it will signify connections * and not really process calls already (but it will signify connections
* that the server is there and will be ready later). Warmup mode will * that the server is there and will be ready later). Warmup mode will

View File

@ -118,7 +118,7 @@ void CMasternodeSync::Process()
//don't begin syncing until we're almost at a recent block //don't begin syncing until we're almost at a recent block
if(pindexPrev->nHeight + 4 < pindexBestHeader->nHeight && pindexPrev->nTime + 600 < GetTime()) return; if(pindexPrev->nHeight + 4 < pindexBestHeader->nHeight && pindexPrev->nTime + 600 < GetTime()) return;
if (pnode->nVersion >= nMasternodeMinProtocol) { if (pnode->nVersion >= masternodePayments.GetMinMasternodePaymentsProto()) {
if(RequestedMasternodeAssets == MASTERNODE_SYNC_LIST) { if(RequestedMasternodeAssets == MASTERNODE_SYNC_LIST) {
if(fDebug) LogPrintf("CMasternodeSync::Process() - lastMasternodeList %lld (GetTime() - MASTERNODE_SYNC_TIMEOUT) %lld\n", lastMasternodeList, GetTime() - MASTERNODE_SYNC_TIMEOUT); if(fDebug) LogPrintf("CMasternodeSync::Process() - lastMasternodeList %lld (GetTime() - MASTERNODE_SYNC_TIMEOUT) %lld\n", lastMasternodeList, GetTime() - MASTERNODE_SYNC_TIMEOUT);
@ -137,9 +137,7 @@ void CMasternodeSync::Process()
} }
return; return;
} }
}
if (pnode->nVersion >= masternodePayments.GetMinMasternodePaymentsProto()) {
if(RequestedMasternodeAssets == MASTERNODE_SYNC_MNW) { if(RequestedMasternodeAssets == MASTERNODE_SYNC_MNW) {
if(lastMasternodeWinner > 0 && lastMasternodeWinner < GetTime() - MASTERNODE_SYNC_TIMEOUT){ //hasn't received a new item in the last five seconds, so we'll move to the if(lastMasternodeWinner > 0 && lastMasternodeWinner < GetTime() - MASTERNODE_SYNC_TIMEOUT){ //hasn't received a new item in the last five seconds, so we'll move to the
GetNextAsset(); GetNextAsset();

View File

@ -302,7 +302,7 @@ bool CMasternodeBroadcast::CheckAndUpdate(int& nDos)
std::string vchPubKey2(pubkey2.begin(), pubkey2.end()); std::string vchPubKey2(pubkey2.begin(), pubkey2.end());
std::string strMessage = addr.ToString() + boost::lexical_cast<std::string>(sigTime) + vchPubKey + vchPubKey2 + boost::lexical_cast<std::string>(protocolVersion); std::string strMessage = addr.ToString() + boost::lexical_cast<std::string>(sigTime) + vchPubKey + vchPubKey2 + boost::lexical_cast<std::string>(protocolVersion);
if(protocolVersion < nMasternodeMinProtocol) { if(protocolVersion < masternodePayments.GetMinMasternodePaymentsProto()) {
LogPrintf("mnb - ignoring outdated Masternode %s protocol version %d\n", vin.ToString().c_str(), protocolVersion); LogPrintf("mnb - ignoring outdated Masternode %s protocol version %d\n", vin.ToString().c_str(), protocolVersion);
return false; return false;
} }
@ -516,7 +516,7 @@ bool CMasternodePing::CheckAndUpdate(int& nDos)
// see if we have this Masternode // see if we have this Masternode
CMasternode* pmn = mnodeman.Find(vin); CMasternode* pmn = mnodeman.Find(vin);
if(pmn != NULL && pmn->IsEnabled() && pmn->protocolVersion >= nMasternodeMinProtocol) if(pmn != NULL && pmn->IsEnabled() && pmn->protocolVersion >= masternodePayments.GetMinMasternodePaymentsProto())
{ {
// LogPrintf("mnping - Found corresponding mn for vin: %s\n", vin.ToString().c_str()); // LogPrintf("mnping - Found corresponding mn for vin: %s\n", vin.ToString().c_str());
// update only if there is no known ping for this masternode or // update only if there is no known ping for this masternode or

View File

@ -239,7 +239,7 @@ void CMasternodeMan::CheckAndRemove(bool forceExpiredRemoval)
if((*it).activeState == CMasternode::MASTERNODE_REMOVE || if((*it).activeState == CMasternode::MASTERNODE_REMOVE ||
(*it).activeState == CMasternode::MASTERNODE_VIN_SPENT || (*it).activeState == CMasternode::MASTERNODE_VIN_SPENT ||
(forceExpiredRemoval && (*it).activeState == CMasternode::MASTERNODE_EXPIRED) || (forceExpiredRemoval && (*it).activeState == CMasternode::MASTERNODE_EXPIRED) ||
(*it).protocolVersion < nMasternodeMinProtocol) { (*it).protocolVersion < masternodePayments.GetMinMasternodePaymentsProto()) {
if(fDebug) LogPrintf("CMasternodeMan: Removing inactive Masternode %s - %i now\n", (*it).addr.ToString().c_str(), size() - 1); if(fDebug) LogPrintf("CMasternodeMan: Removing inactive Masternode %s - %i now\n", (*it).addr.ToString().c_str(), size() - 1);
it = vMasternodes.erase(it); it = vMasternodes.erase(it);
} else { } else {
@ -292,6 +292,7 @@ void CMasternodeMan::Clear()
int CMasternodeMan::CountEnabled(int protocolVersion) int CMasternodeMan::CountEnabled(int protocolVersion)
{ {
int i = 0; int i = 0;
protocolVersion = protocolVersion == -1 ? masternodePayments.GetMinMasternodePaymentsProto() : protocolVersion;
BOOST_FOREACH(CMasternode& mn, vMasternodes) { BOOST_FOREACH(CMasternode& mn, vMasternodes) {
mn.Check(); mn.Check();
@ -378,7 +379,7 @@ CMasternode* CMasternodeMan::GetNextMasternodeInQueueForPayment(int nBlockHeight
if(masternodePayments.IsScheduled(mn, nBlockHeight)) continue; if(masternodePayments.IsScheduled(mn, nBlockHeight)) continue;
//make sure it has as many confirmations as there are masternodes //make sure it has as many confirmations as there are masternodes
if(mn.GetMasternodeInputAge() < CountEnabled(masternodePayments.GetMinMasternodePaymentsProto())) continue; if(mn.GetMasternodeInputAge() < CountEnabled()) continue;
if(pOldestMasternode == NULL || pOldestMasternode->SecondsSincePayment() < mn.SecondsSincePayment()){ if(pOldestMasternode == NULL || pOldestMasternode->SecondsSincePayment() < mn.SecondsSincePayment()){
pOldestMasternode = &mn; pOldestMasternode = &mn;

View File

@ -101,7 +101,7 @@ public:
/// Clear Masternode vector /// Clear Masternode vector
void Clear(); void Clear();
int CountEnabled(int protocolVersion = nMasternodeMinProtocol); int CountEnabled(int protocolVersion = -1);
void DsegUpdate(CNode* pnode); void DsegUpdate(CNode* pnode);

View File

@ -113,7 +113,6 @@ int nAnonymizeDarkcoinAmount = 1000;
int nLiquidityProvider = 0; int nLiquidityProvider = 0;
/** Spork enforcement enabled time */ /** Spork enforcement enabled time */
int64_t enforceMasternodePaymentsTime = 4085657524; int64_t enforceMasternodePaymentsTime = 4085657524;
int nMasternodeMinProtocol = 0;
bool fSucessfullyLoaded = false; bool fSucessfullyLoaded = false;
bool fEnableDarksend = false; bool fEnableDarksend = false;
/** All denominations used by darksend */ /** All denominations used by darksend */

View File

@ -39,7 +39,6 @@ extern int nLiquidityProvider;
extern bool fEnableDarksend; extern bool fEnableDarksend;
extern int64_t enforceMasternodePaymentsTime; extern int64_t enforceMasternodePaymentsTime;
extern std::string strMasterNodeAddr; extern std::string strMasterNodeAddr;
extern int nMasternodeMinProtocol;
extern int keysLoaded; extern int keysLoaded;
extern bool fSucessfullyLoaded; extern bool fSucessfullyLoaded;
extern std::vector<int64_t> darkSendDenominations; extern std::vector<int64_t> darkSendDenominations;