mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Replace the use of hanko with public keys.
This commit is contained in:
@@ -60,8 +60,7 @@ const char *WalletDBInit[] = {
|
|||||||
PrivateKey CHARACTER(52) \
|
PrivateKey CHARACTER(52) \
|
||||||
);",
|
);",
|
||||||
"CREATE TABLE TrustedNodes ( \
|
"CREATE TABLE TrustedNodes ( \
|
||||||
Hanko CHARACTER(35) PRIMARY KEY, \
|
PublicKey CHARACTER(53) PRIMARY KEY, \
|
||||||
PublicKey CHARACTER(53), \
|
|
||||||
Comment TEXT \
|
Comment TEXT \
|
||||||
);"
|
);"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -592,23 +592,23 @@ Json::Value RPCServer::doUnlDefault(Json::Value& params) {
|
|||||||
else return "invalid params";
|
else return "invalid params";
|
||||||
}
|
}
|
||||||
|
|
||||||
// unl_delete <hanko>
|
// unl_delete <public_key>
|
||||||
Json::Value RPCServer::doUnlDelete(Json::Value& params) {
|
Json::Value RPCServer::doUnlDelete(Json::Value& params) {
|
||||||
if(params.size()==1)
|
if(params.size()==1)
|
||||||
{
|
{
|
||||||
std::string strHanko=params[0u].asString();
|
std::string strNodePublic=params[0u].asString();
|
||||||
|
|
||||||
NewcoinAddress hanko;
|
NewcoinAddress naNodePublic;
|
||||||
|
|
||||||
if(hanko.setHanko(strHanko))
|
if(naNodePublic.setNodePublic(strNodePublic))
|
||||||
{
|
{
|
||||||
theApp->getUNL().nodeRemove(hanko);
|
theApp->getUNL().nodeRemove(naNodePublic);
|
||||||
|
|
||||||
return "removing node";
|
return "removing node";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "invalid hanko";
|
return "invalid public key";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return "invalid params";
|
else return "invalid params";
|
||||||
|
|||||||
@@ -276,14 +276,10 @@ void UniqueNodeList::nodeAdd(NewcoinAddress naNodePublic, std::string strComment
|
|||||||
{
|
{
|
||||||
Database* db=theApp->getWalletDB()->getDB();
|
Database* db=theApp->getWalletDB()->getDB();
|
||||||
|
|
||||||
std::string strHanko = naNodePublic.humanHanko();
|
|
||||||
std::string strPublicKey = naNodePublic.humanNodePublic();
|
std::string strPublicKey = naNodePublic.humanNodePublic();
|
||||||
std::string strTmp;
|
std::string strTmp;
|
||||||
|
|
||||||
std::string strSql="INSERT INTO TrustedNodes (Hanko,PublicKey,Comment) values (";
|
std::string strSql="INSERT INTO TrustedNodes (PublicKey,Comment) values (";
|
||||||
db->escape(reinterpret_cast<const unsigned char*>(strHanko.c_str()), strHanko.size(), strTmp);
|
|
||||||
strSql.append(strTmp);
|
|
||||||
strSql.append(",");
|
|
||||||
db->escape(reinterpret_cast<const unsigned char*>(strPublicKey.c_str()), strPublicKey.size(), strTmp);
|
db->escape(reinterpret_cast<const unsigned char*>(strPublicKey.c_str()), strPublicKey.size(), strTmp);
|
||||||
strSql.append(strTmp);
|
strSql.append(strTmp);
|
||||||
strSql.append(",");
|
strSql.append(",");
|
||||||
@@ -295,15 +291,15 @@ void UniqueNodeList::nodeAdd(NewcoinAddress naNodePublic, std::string strComment
|
|||||||
db->executeSQL(strSql.c_str());
|
db->executeSQL(strSql.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UniqueNodeList::nodeRemove(NewcoinAddress naHanko)
|
void UniqueNodeList::nodeRemove(NewcoinAddress naNodePublic)
|
||||||
{
|
{
|
||||||
Database* db=theApp->getWalletDB()->getDB();
|
Database* db=theApp->getWalletDB()->getDB();
|
||||||
|
|
||||||
std::string strHanko = naHanko.humanHanko();
|
std::string strPublic = naNodePublic.humanNodePublic();
|
||||||
std::string strTmp;
|
std::string strTmp;
|
||||||
|
|
||||||
std::string strSql = "DELETE FROM TrustedNodes where Hanko=";
|
std::string strSql = "DELETE FROM TrustedNodes where PublicKey=";
|
||||||
db->escape(reinterpret_cast<const unsigned char*>(strHanko.c_str()), strHanko.size(), strTmp);
|
db->escape(reinterpret_cast<const unsigned char*>(strPublic.c_str()), strPublic.size(), strTmp);
|
||||||
strSql.append(strTmp);
|
strSql.append(strTmp);
|
||||||
|
|
||||||
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
ScopedLock sl(theApp->getWalletDB()->getDBLock());
|
||||||
@@ -359,17 +355,14 @@ Json::Value UniqueNodeList::getUnlJson()
|
|||||||
bool more = db->startIterRows();
|
bool more = db->startIterRows();
|
||||||
while (more)
|
while (more)
|
||||||
{
|
{
|
||||||
std::string strHanko;
|
|
||||||
std::string strPublicKey;
|
std::string strPublicKey;
|
||||||
std::string strComment;
|
std::string strComment;
|
||||||
|
|
||||||
db->getStr("Hanko", strHanko);
|
|
||||||
db->getStr("PublicKey", strPublicKey);
|
db->getStr("PublicKey", strPublicKey);
|
||||||
db->getStr("Comment", strComment);
|
db->getStr("Comment", strComment);
|
||||||
|
|
||||||
Json::Value node(Json::objectValue);
|
Json::Value node(Json::objectValue);
|
||||||
|
|
||||||
node["Hanko"] = strHanko;
|
|
||||||
node["PublicKey"] = strPublicKey;
|
node["PublicKey"] = strPublicKey;
|
||||||
node["Comment"] = strComment;
|
node["Comment"] = strComment;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
void nodeAdd(NewcoinAddress naNodePublic, std::string strComment);
|
void nodeAdd(NewcoinAddress naNodePublic, std::string strComment);
|
||||||
void nodeFetch(std::string strDomain);
|
void nodeFetch(std::string strDomain);
|
||||||
void nodeRemove(NewcoinAddress naHanko);
|
void nodeRemove(NewcoinAddress naNodePublic);
|
||||||
void nodeDefault(std::string strValidators);
|
void nodeDefault(std::string strValidators);
|
||||||
void nodeReset();
|
void nodeReset();
|
||||||
|
|
||||||
|
|||||||
@@ -350,9 +350,6 @@ bool Wallet::nodeIdentityLoad()
|
|||||||
|
|
||||||
db->endIterRows();
|
db->endIterRows();
|
||||||
|
|
||||||
// Derive hanko from public key.
|
|
||||||
mNodeHanko.setHanko(mNodePublicKey);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +406,6 @@ void Wallet::load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "NodeIdentity:" << std::endl;
|
std::cerr << "NodeIdentity:" << std::endl;
|
||||||
fprintf(stderr, "hanko: %s\n", mNodeHanko.humanHanko().c_str());
|
|
||||||
fprintf(stderr, "public: %s\n", mNodePublicKey.humanNodePublic().c_str());
|
fprintf(stderr, "public: %s\n", mNodePublicKey.humanNodePublic().c_str());
|
||||||
fprintf(stderr, "private: %s\n", mNodePrivateKey.humanNodePrivate().c_str());
|
fprintf(stderr, "private: %s\n", mNodePrivateKey.humanNodePrivate().c_str());
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
boost::recursive_mutex mLock;
|
boost::recursive_mutex mLock;
|
||||||
|
|
||||||
NewcoinAddress mNodeHanko;
|
|
||||||
NewcoinAddress mNodePublicKey;
|
NewcoinAddress mNodePublicKey;
|
||||||
NewcoinAddress mNodePrivateKey;
|
NewcoinAddress mNodePrivateKey;
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void printHelp()
|
|||||||
cout << " stop" << endl;
|
cout << " stop" << endl;
|
||||||
cout << " tx" << endl;
|
cout << " tx" << endl;
|
||||||
cout << " unl_add <public> [<comment>]" << endl;
|
cout << " unl_add <public> [<comment>]" << endl;
|
||||||
cout << " unl_delete <hanko>" << endl;
|
cout << " unl_delete <public_key>" << endl;
|
||||||
cout << " unl_list" << endl;
|
cout << " unl_list" << endl;
|
||||||
cout << " unl_reset" << endl;
|
cout << " unl_reset" << endl;
|
||||||
cout << " unlock <passphrase>" << endl;
|
cout << " unlock <passphrase>" << endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user