mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-08 22:08:00 +00:00
make soft checkpoint less verbose
This commit is contained in:
parent
555e711b09
commit
18493205fc
@ -241,6 +241,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "sendrawtransaction", &sendrawtransaction, false, false },
|
||||
{ "sendnewusertransaction", &sendnewusertransaction, false, false },
|
||||
{ "verifychain", &verifychain, true, false },
|
||||
{ "getlastsoftcheckpoint", &getlastsoftcheckpoint, true, false },
|
||||
// twister dht network
|
||||
{ "dhtput", &dhtput, false, true },
|
||||
{ "dhtget", &dhtget, false, true },
|
||||
|
@ -194,6 +194,7 @@ extern json_spirit::Value getblock(const json_spirit::Array& params, bool fHelp)
|
||||
extern json_spirit::Value gettxoutsetinfo(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value gettxout(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value verifychain(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value getlastsoftcheckpoint(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value dhtput(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value dhtget(const json_spirit::Array& params, bool fHelp);
|
||||
extern json_spirit::Value newpostmsg(const json_spirit::Array& params, bool fHelp);
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "bitcoinrpc.h"
|
||||
#include "softcheckpoint.h"
|
||||
|
||||
using namespace json_spirit;
|
||||
using namespace std;
|
||||
@ -203,3 +204,29 @@ Value verifychain(const Array& params, bool fHelp)
|
||||
return VerifyDB(nCheckLevel, nCheckDepth);
|
||||
}
|
||||
|
||||
|
||||
Value getlastsoftcheckpoint(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getlastsoftcheckpoint"
|
||||
"Returns votes of last soft checkpoint.");
|
||||
|
||||
Object result;
|
||||
|
||||
int height;
|
||||
uint256 hash;
|
||||
std::set<std::string> usernamesSet;
|
||||
if( SoftCheckpoints::GetLastCPVotes(height, hash, usernamesSet) ) {
|
||||
result.push_back(Pair("height", height));
|
||||
result.push_back(Pair("hash", hash.GetHex()));
|
||||
|
||||
Array usernames;
|
||||
BOOST_FOREACH(const std::string &user, usernamesSet) {
|
||||
usernames.push_back(user);
|
||||
}
|
||||
result.push_back(Pair("usernames", usernames));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "init.h"
|
||||
#include "twister.h"
|
||||
|
||||
#define dbgprintf OutputDebugStringF
|
||||
//#define dbgprintf(...) // no debug printf
|
||||
//#define dbgprintf OutputDebugStringF
|
||||
#define dbgprintf(...) // no debug printf
|
||||
|
||||
namespace SoftCheckpoints
|
||||
{
|
||||
@ -266,4 +266,19 @@ namespace SoftCheckpoints
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GetLastCPVotes(int &height, uint256 &hash, std::set<std::string> &usernames) {
|
||||
LOCK(cs_softCP);
|
||||
if (!lastSoftCP.first)
|
||||
return false;
|
||||
|
||||
height = lastSoftCP.first;
|
||||
hash = lastSoftCP.second;
|
||||
|
||||
usernames.clear();
|
||||
BOOST_FOREACH(const CPSigMap::value_type& i, lastSoftCPSigs) {
|
||||
usernames.insert(i.first);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ namespace SoftCheckpoints
|
||||
void RelayCP(const CSoftCheckpoint& cp, CNode* pfrom);
|
||||
|
||||
void RelayLastCPToNode(CNode* pnode);
|
||||
|
||||
bool GetLastCPVotes(int &height, uint256 &hash, std::set<std::string> &usernames);
|
||||
}
|
||||
|
||||
class CSoftCheckpoint
|
||||
|
Loading…
Reference in New Issue
Block a user