error checks
This commit is contained in:
@@ -4978,13 +4978,19 @@ UniValue setpubkey(const UniValue& params, bool fHelp)
|
|||||||
uint8_t pubkey33[33];
|
uint8_t pubkey33[33];
|
||||||
extern uint8_t NOTARY_PUBKEY33[];
|
extern uint8_t NOTARY_PUBKEY33[];
|
||||||
extern std::string NOTARY_PUBKEY;
|
extern std::string NOTARY_PUBKEY;
|
||||||
if ( NOTARY_PUBKEY33[0] == 0 && strlen(params[0].get_str().c_str()) == 66 ) {
|
if ( NOTARY_PUBKEY33[0] == 0 ) {
|
||||||
//LOCK(cs_main);
|
if (strlen(params[0].get_str().c_str()) == 66) {
|
||||||
NOTARY_PUBKEY = params[0].get_str();
|
decode_hex(pubkey33,33,(char *)params[0].get_str().c_str());
|
||||||
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
|
pubkey2addr((char *)address,(uint8_t *)pubkey33);
|
||||||
decode_hex(pubkey33,33,(char *)params[0].get_str().c_str());
|
if (strncmp("RRmWExvapDM9YbLT9X9xAyzDgxomYf63ng",address) == 0) {
|
||||||
pubkey2addr((char *)address,(uint8_t *)pubkey33);
|
result.push_back(Pair("error", "pubkey entered is invalid."));
|
||||||
result.push_back(Pair("R-address", address));
|
} else {
|
||||||
|
LOCK(cs_main);
|
||||||
|
NOTARY_PUBKEY = params[0].get_str();
|
||||||
|
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
|
||||||
|
result.push_back(Pair("R-address", address));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon."));
|
result.push_back(Pair("error", "Can only set pubkey once, to change it you need to restart your daemon."));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user