Add unl_reset command.

This commit is contained in:
Arthur Britto
2012-03-21 14:43:13 -07:00
parent d070b10f21
commit 867835fcfa
3 changed files with 17 additions and 4 deletions

View File

@@ -557,8 +557,14 @@ Json::Value RPCServer::doUnlList(Json::Value& params) {
return theApp->getUNL().getUnlJson();
}
// unl_reset
Json::Value RPCServer::doUnlReset(Json::Value& params) {
return "not implemented";
if(!params.size())
{
theApp->getUNL().reset();
return "removing nodes";
}
else return "invalid params";
}
Json::Value RPCServer::doCommand(const std::string& command, Json::Value& params)

View File

@@ -40,6 +40,15 @@ void UniqueNodeList::removeNode(NewcoinAddress hanko)
db->executeSQL(strSql.c_str());
}
void UniqueNodeList::reset()
{
Database* db=theApp->getWalletDB()->getDB();
std::string strSql = "DELETE FROM TrustedNodes";
ScopedLock sl(theApp->getWalletDB()->getDBLock());
db->executeSQL(strSql.c_str());
}
// 0- we don't care, 1- we care and is valid, 2-invalid signature
#if 0
int UniqueNodeList::checkValid(newcoin::Validation& valid)

View File

@@ -11,11 +11,9 @@ class UniqueNodeList
// hanko to public key
//std::map<uint160, uint256> mUNL;
public:
//void load();
//void save();
void addNode(NewcoinAddress nodePublic, std::string strComment);
void removeNode(NewcoinAddress hanko);
void reset();
// 0- we don't care, 1- we care and is valid, 2-invalid signature
// int checkValid(newcoin::Validation& valid);