mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -60,7 +60,7 @@ const char *WalletDBInit[] = {
|
||||
"CREATE TABLE NodeIdentity ( \
|
||||
PublicKey CHARACTER(53), \
|
||||
PrivateKey CHARACTER(52) \
|
||||
);"
|
||||
);",
|
||||
"CREATE TABLE TrustedNodes ( \
|
||||
Hanko CHARACTER(35) PRIMARY KEY, \
|
||||
PublicKey CHARACTER(53), \
|
||||
|
||||
@@ -67,7 +67,7 @@ void RPCServer::handle_read(const boost::system::error_code& e,
|
||||
}
|
||||
else if(e != boost::asio::error::operation_aborted)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ std::string RPCServer::handleRequest(const std::string& requestStr)
|
||||
{
|
||||
std::cout << "handleRequest " << requestStr << std::endl;
|
||||
Json::Value id;
|
||||
|
||||
|
||||
// Parse request
|
||||
Json::Value valRequest;
|
||||
Json::Reader reader;
|
||||
@@ -497,21 +497,21 @@ Json::Value RPCServer::doLedger(Json::Value& params)
|
||||
return "not implemented";
|
||||
}
|
||||
|
||||
// unl_add <node_public>
|
||||
// unl_add <node_public> <comment>
|
||||
Json::Value RPCServer::doUnlAdd(Json::Value& params) {
|
||||
// unl_add <node_public>
|
||||
// unl_add <node_public> <comment>
|
||||
if(params.size()==1 || params.size()==2)
|
||||
{
|
||||
std::string pubKey=params[0u].asString();
|
||||
std::string comment=params.size() == 2
|
||||
std::string strNodePublic=params[0u].asString();
|
||||
std::string strComment=params.size() == 2
|
||||
? ""
|
||||
: params[1u].asString();
|
||||
|
||||
NewcoinAddress nodePublic;
|
||||
|
||||
if(nodePublic.setNodePublic(pubKey))
|
||||
if(nodePublic.setNodePublic(strNodePublic))
|
||||
{
|
||||
theApp->getUNL().addNode(nodePublic, comment);
|
||||
theApp->getUNL().addNode(nodePublic, strComment);
|
||||
|
||||
return "adding node";
|
||||
}
|
||||
@@ -527,8 +527,26 @@ Json::Value RPCServer::doUnlDefault(Json::Value& params) {
|
||||
return "not implemented";
|
||||
}
|
||||
|
||||
// unl_delete <hanko>
|
||||
Json::Value RPCServer::doUnlDelete(Json::Value& params) {
|
||||
return "not implemented";
|
||||
if(params.size()==1)
|
||||
{
|
||||
std::string strHanko=params[0u].asString();
|
||||
|
||||
NewcoinAddress hanko;
|
||||
|
||||
if(hanko.setHanko(strHanko))
|
||||
{
|
||||
theApp->getUNL().removeNode(hanko);
|
||||
|
||||
return "removing node";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "invalid hanko";
|
||||
}
|
||||
}
|
||||
else return "invalid params";
|
||||
}
|
||||
|
||||
Json::Value RPCServer::doUnlFetch(Json::Value& params) {
|
||||
@@ -539,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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
19
src/main.cpp
19
src/main.cpp
@@ -25,19 +25,22 @@ void printHelp()
|
||||
cout << "options: " << endl;
|
||||
cout << " -" << endl;
|
||||
cout << "commands: " << endl;
|
||||
cout << " createfamily [<key>]" << endl;
|
||||
cout << " accountinfo <family>:<key>" << endl;
|
||||
cout << " newaccount <family> [<name>]" << endl;
|
||||
cout << " lock <family>" << endl;
|
||||
cout << " unlock <passphrase>" << endl;
|
||||
cout << " familyinfo" << endl;
|
||||
cout << " connect <ip> [<port>]" << endl;
|
||||
cout << " createfamily [<key>]" << endl;
|
||||
cout << " familyinfo" << endl;
|
||||
cout << " ledger" << endl;
|
||||
cout << " lock <family>" << endl;
|
||||
cout << " newaccount <family> [<name>]" << endl;
|
||||
cout << " peers" << endl;
|
||||
cout << " sendto <destination> <amount> [<tag>]" << endl;
|
||||
cout << " tx" << endl;
|
||||
cout << " ledger" << endl;
|
||||
cout << " stop" << endl;
|
||||
|
||||
cout << " tx" << endl;
|
||||
cout << " unl_add <public> [<comment>]" << endl;
|
||||
cout << " unl_delete <hanko>" << endl;
|
||||
cout << " unl_list" << endl;
|
||||
cout << " unl_reset" << endl;
|
||||
cout << " unlock <passphrase>" << endl;
|
||||
}
|
||||
|
||||
int parseCommandline(int argc, char* argv[])
|
||||
|
||||
Reference in New Issue
Block a user