if (fHelp || params.size() != 0)
throw runtime_error(
"getdifficulty\n"
- "Returns the proof-of-work difficulty as a multiple of the minimum difficulty.");
+ "Returns difficulty as a multiple of the minimum difficulty.");
- return GetDifficulty();
+ Object obj;
+ obj.push_back(Pair("proof-of-work", GetDifficulty()));
+ obj.push_back(Pair("proof-of-stake", GetDifficulty(GetLastBlockIndex(pindexBest, true))));
+ return obj;
}
pindexCheckpoint = mapBlockIndex[Checkpoints::hashSyncCheckpoint];
result.push_back(Pair("height", pindexCheckpoint->nHeight));
result.push_back(Pair("timestamp", DateTimeStrFormat(pindexCheckpoint->GetBlockTime()).c_str()));
-
+ if (mapArgs.count("-checkpointkey"))
+ result.push_back(Pair("checkpointmaster", true));
+
return result;
}
// ThreadRPCServer: holds cs_main and acquiring cs_vSend in alert.RelayTo()/PushMessage()/BeginMessage()
Value sendalert(const Array& params, bool fHelp)
{
- if (fHelp || params.size() < 5)
+ if (fHelp || params.size() < 6)
throw runtime_error(
- "sendalert <message> <privatekey> <minver> <maxver> <id> [cancelupto]\n"
+ "sendalert <message> <privatekey> <minver> <maxver> <priority> <id> [cancelupto]\n"
"<message> is the alert text message\n"
"<privatekey> is hex string of alert master private key\n"
- "<minver> is the minimum applicable client version\n"
- "<maxver> is the maximum applicable client version\n"
+ "<minver> is the minimum applicable internal client version\n"
+ "<maxver> is the maximum applicable internal client version\n"
+ "<priority> is integer priority number\n"
"<id> is the alert id\n"
"[cancelupto] cancels all alert id's up to this number\n"
- "Returns true or false.");
+ "Returns true or false.");
CAlert alert;
CKey key;
alert.strStatusBar = params[0].get_str();
alert.nMinVer = params[2].get_int();
alert.nMaxVer = params[3].get_int();
- alert.nID = params[4].get_int();
- if (params.size() > 5)
- alert.nCancel = params[5].get_int();
+ alert.nPriority = params[4].get_int();
+ alert.nID = params[5].get_int();
+ if (params.size() > 6)
+ alert.nCancel = params[6].get_int();
alert.nVersion = PROTOCOL_VERSION;
alert.nRelayUntil = GetAdjustedTime() + 365*24*60*60;
alert.nExpiration = GetAdjustedTime() + 365*24*60*60;
- alert.nPriority = 1;
CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION);
sMsg << (CUnsignedAlert)alert;
result.push_back(Pair("nVersion", alert.nVersion));
result.push_back(Pair("nMinVer", alert.nMinVer));
result.push_back(Pair("nMaxVer", alert.nMaxVer));
+ result.push_back(Pair("nPriority", alert.nPriority));
result.push_back(Pair("nID", alert.nID));
if (alert.nCancel > 0)
result.push_back(Pair("nCancel", alert.nCancel));
return result;
}
-// ppcoin: set checkpoint key
-Value setcheckpointkey(const Array& params, bool fHelp)
-{
- if (fHelp || params.size() != 1)
- throw runtime_error(
- "setcheckpointkey <privatekey>\n"
- "<privatekey> is hex string of checkpoint master private key\n");
-
- CSyncCheckpoint checkpoint;
- checkpoint.hashCheckpoint = hashGenesisBlock;
- CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION);
- sMsg << (CUnsignedSyncCheckpoint)checkpoint;
- checkpoint.vchMsg = vector<unsigned char>(sMsg.begin(), sMsg.end());
-
- vector<unsigned char> vchPrivKey = ParseHex(params[0].get_str());
- CKey key;
- key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash
- if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig))
- throw runtime_error(
- "Unable to sign checkpoint, check private key?\n");
-
- CSyncCheckpoint::strMasterPrivKey = params[0].get_str();
-
- return "checkpoint master key has been set.";
-}
//
{ "repairwallet", &repairwallet, false},
{ "makekeypair", &makekeypair, false},
{ "sendalert", &sendalert, false},
- { "setcheckpointkey", &setcheckpointkey, false},
};
CRPCTable::CRPCTable()
if (strMethod == "sendalert" && n > 3) ConvertTo<boost::int64_t>(params[3]);
if (strMethod == "sendalert" && n > 4) ConvertTo<boost::int64_t>(params[4]);
if (strMethod == "sendalert" && n > 5) ConvertTo<boost::int64_t>(params[5]);
+ if (strMethod == "sendalert" && n > 6) ConvertTo<boost::int64_t>(params[6]);
if (strMethod == "sendmany" && n > 1)
{
string s = params[1].get_str();