diff --git a/src/RPCServer.cpp b/src/RPCServer.cpp index 27582e2c3a..74c87584d1 100644 --- a/src/RPCServer.cpp +++ b/src/RPCServer.cpp @@ -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) diff --git a/src/UniqueNodeList.cpp b/src/UniqueNodeList.cpp index 7779fe522f..2c4457322c 100644 --- a/src/UniqueNodeList.cpp +++ b/src/UniqueNodeList.cpp @@ -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) diff --git a/src/UniqueNodeList.h b/src/UniqueNodeList.h index d43f58133f..88b0f0afa8 100644 --- a/src/UniqueNodeList.h +++ b/src/UniqueNodeList.h @@ -11,11 +11,9 @@ class UniqueNodeList // hanko to public key //std::map 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);