Added calcscore cmd
This commit is contained in:
parent
85e1280bc3
commit
c137a204fb
@ -128,7 +128,7 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "stop" && strCommand != "stop-alias" &&
|
(strCommand != "start" && strCommand != "start-alias" && strCommand != "start-many" && strCommand != "stop" && strCommand != "stop-alias" &&
|
||||||
strCommand != "stop-many" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce" &&
|
strCommand != "stop-many" && strCommand != "list" && strCommand != "list-conf" && strCommand != "count" && strCommand != "enforce" &&
|
||||||
strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect" &&
|
strCommand != "debug" && strCommand != "current" && strCommand != "winners" && strCommand != "genkey" && strCommand != "connect" &&
|
||||||
strCommand != "outputs" && strCommand != "status"))
|
strCommand != "outputs" && strCommand != "status" && strCommand != "calcscore"))
|
||||||
throw runtime_error(
|
throw runtime_error(
|
||||||
"masternode \"command\"... ( \"passphrase\" )\n"
|
"masternode \"command\"... ( \"passphrase\" )\n"
|
||||||
"Set of commands to execute masternode related actions\n"
|
"Set of commands to execute masternode related actions\n"
|
||||||
@ -467,6 +467,36 @@ Value masternode(const Array& params, bool fHelp)
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Shows which masternode wins by score each block
|
||||||
|
*/
|
||||||
|
if (strCommand == "calcscore")
|
||||||
|
{
|
||||||
|
int nLast = 10;
|
||||||
|
|
||||||
|
if (params.size() >= 2){
|
||||||
|
nLast = atoi(params[1].get_str());
|
||||||
|
}
|
||||||
|
Object obj;
|
||||||
|
|
||||||
|
std::vector<CMasternode> vMasternodes = mnodeman.GetFullMasternodeVector();
|
||||||
|
for(int nHeight = chainActive.Tip()->nHeight-nLast; nHeight < chainActive.Tip()->nHeight+20; nHeight++){
|
||||||
|
uint256 nHigh = 0;
|
||||||
|
CMasternode *pBestMasternode = NULL;
|
||||||
|
BOOST_FOREACH(CMasternode& mn, vMasternodes) {
|
||||||
|
uint256 n = mn.CalculateScore(1, nHeight-100);
|
||||||
|
if(n > nHigh){
|
||||||
|
nHigh = n;
|
||||||
|
pBestMasternode = &mn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(pBestMasternode)
|
||||||
|
obj.push_back(Pair(strprintf("%d", nHeight), pBestMasternode->vin.prevout.ToStringShort().c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
return Value::null;
|
return Value::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user