From: Richard Smith Date: Tue, 26 Jun 2012 20:55:24 +0000 (+0100) Subject: PPCoin: Add RPC command 'getcheckpoint' X-Git-Tag: v0.4.0-unstable~139 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=b0ec2702f495d3f806eebdacef57a39f72afdb13 PPCoin: Add RPC command 'getcheckpoint' --- diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 16fc8c5..583884d 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1802,6 +1802,26 @@ Value getmemorypool(const Array& params, bool fHelp) } +// ppcoin: get information of sync-checkpoint +Value getcheckpoint(const Array& params, bool fHelp) +{ + if (fHelp || params.size() != 0) + throw runtime_error( + "getcheckpoint\n" + "Show info of synchronized checkpoint.\n"); + + Object result; + CBlockIndex* pindexCheckpoint; + + result.push_back(Pair("synccheckpoint", Checkpoints::hashSyncCheckpoint.ToString().c_str())); + pindexCheckpoint = mapBlockIndex[Checkpoints::hashSyncCheckpoint]; + result.push_back(Pair("height", pindexCheckpoint->nHeight)); + result.push_back(Pair("timestamp", DateTimeStrFormat("%x %H:%M:%S", pindexCheckpoint->GetBlockTime()).c_str())); + + return result; +} + + // ppcoin: reserve balance from being staked for network protection Value reservebalance(const Array& params, bool fHelp) { @@ -2074,6 +2094,7 @@ pair pCallTable[] = make_pair("settxfee", &settxfee), make_pair("getmemorypool", &getmemorypool), make_pair("listsinceblock", &listsinceblock), + make_pair("getcheckpoint", &getcheckpoint), make_pair("reservebalance", &reservebalance), make_pair("checkwallet", &checkwallet), make_pair("repairwallet", &repairwallet), @@ -2106,6 +2127,7 @@ string pAllowInSafeMode[] = "validateaddress", "getwork", "getmemorypool", + "getcheckpoint", }; set setAllowInSafeMode(pAllowInSafeMode, pAllowInSafeMode + sizeof(pAllowInSafeMode)/sizeof(pAllowInSafeMode[0]));