This commit is contained in:
blackjok3r
2018-10-24 14:58:07 +08:00
parent ecfeb9dd9c
commit b412964cf2

View File

@@ -4967,6 +4967,7 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
"\nResult:\n"
" {\n"
" \"pubkey\" : \"pubkey\", (string) The pubkey\n"
" \"R-address\" : \"R address\", (string) The pubkey\n"
" }\n"
"\nExamples:\n"
+ HelpExampleCli("setpubkey", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e")
@@ -4975,16 +4976,14 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
char address[18];
uint8_t pubkey33[33];
decode_hex(pubkey33,33,(char *)params[0].get_str().c_str());
if (pubkey2addr((char *)address,(uint8_t *)pubkey33))
printf("%s\n",address);
extern uint8_t NOTARY_PUBKEY33[];
extern std::string NOTARY_PUBKEY;
if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) {
//LOCK(cs_main);
NOTARY_PUBKEY = params[0].get_str();
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
decode_hex(pubkey33,33,(char *)params[0].get_str().c_str());
pubkey2addr((char *)address,(uint8_t *)pubkey33)
result.push_back(Pair("R-address", address));
} else {
result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon."));