mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Spork changes / improvements
- New Command "Spork Active" : Show which sporks report as active - Cleaned up the spork code and fixed some bugs with defaults
This commit is contained in:
parent
94493bee63
commit
e3963ea71c
@ -299,9 +299,11 @@ bool CMasternodeBlockPayees::IsTransactionValid(const CTransaction& txNew)
|
||||
BOOST_FOREACH(CMasternodePayee& payee, vecPayments)
|
||||
{
|
||||
bool found = false;
|
||||
BOOST_FOREACH(CTxOut out, txNew.vout)
|
||||
if(payee.scriptPubKey == out.scriptPubKey && payee.nValue == out.nValue)
|
||||
BOOST_FOREACH(CTxOut out, txNew.vout){
|
||||
if(payee.scriptPubKey == out.scriptPubKey && payee.nValue == out.nValue){
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(payee.nVotes >= MNPAYMENTS_SIGNATURES_REQUIRED){
|
||||
if(found) return true;
|
||||
|
@ -165,10 +165,21 @@ Value spork(const Array& params, bool fHelp)
|
||||
|
||||
Object ret;
|
||||
while(it != mapSporksActive.end()) {
|
||||
if(sporkManager.GetSporkNameByID(it->second.nSporkID) != "Unknown")
|
||||
ret.push_back(Pair(sporkManager.GetSporkNameByID(it->second.nSporkID), it->second.nValue));
|
||||
it++;
|
||||
}
|
||||
return ret;
|
||||
} else if(params.size() == 1 && params[0].get_str() == "active"){
|
||||
std::map<int, CSporkMessage>::iterator it = mapSporksActive.begin();
|
||||
|
||||
Object ret;
|
||||
while(it != mapSporksActive.end()) {
|
||||
if(sporkManager.GetSporkNameByID(it->second.nSporkID) != "Unknown")
|
||||
ret.push_back(Pair(sporkManager.GetSporkNameByID(it->second.nSporkID), IsSporkActive(it->second.nSporkID)));
|
||||
it++;
|
||||
}
|
||||
return ret;
|
||||
} else if (params.size() == 2){
|
||||
int nSporkID = sporkManager.GetSporkIDByName(params[0].get_str());
|
||||
if(nSporkID == -1){
|
||||
@ -189,7 +200,7 @@ Value spork(const Array& params, bool fHelp)
|
||||
|
||||
throw runtime_error(
|
||||
"spork <name> [<value>]\n"
|
||||
"<name> is the corresponding spork name, or 'show' to show all current spork settings"
|
||||
"<name> is the corresponding spork name, or 'show' to show all current spork settings, active to show which sporks are active"
|
||||
"<value> is a epoch datetime to enable or disable spork"
|
||||
+ HelpRequiringPassphrase());
|
||||
}
|
||||
|
@ -84,9 +84,9 @@ bool IsSporkActive(int nSporkID)
|
||||
if(nSporkID == SPORK_2_INSTANTX) r = SPORK_2_INSTANTX_DEFAULT;
|
||||
if(nSporkID == SPORK_3_INSTANTX_BLOCK_FILTERING) r = SPORK_3_INSTANTX_BLOCK_FILTERING_DEFAULT;
|
||||
if(nSporkID == SPORK_5_MAX_VALUE) r = SPORK_5_MAX_VALUE_DEFAULT;
|
||||
if(nSporkID == SPORK_7_MASTERNODE_SCANNING) r = SPORK_7_MASTERNODE_SCANNING;
|
||||
if(nSporkID == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) r = SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT;
|
||||
if(nSporkID == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) r = SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT;
|
||||
if(nSporkID == SPORK_7_MASTERNODE_SCANNING) r = SPORK_7_MASTERNODE_SCANNING_DEFAULT;
|
||||
if(nSporkID == SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT) r = SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT_DEFAULT;
|
||||
if(nSporkID == SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT) r = SPORK_9_MASTERNODE_BUDGET_ENFORCEMENT_DEFAULT;
|
||||
|
||||
if(r == 0) LogPrintf("GetSpork::Unknown Spork %d\n", nSporkID);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user