add rpc to return pubkey

This commit is contained in:
blackjok3r
2018-10-24 12:12:18 +08:00
parent 5a363fdffc
commit c4ee47ec36
4 changed files with 36 additions and 15 deletions

View File

@@ -4953,6 +4953,35 @@ UniValue channelsaddress(const UniValue& params, bool fHelp)
return(result);
}
UniValue getpubkey(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ);
if (fHelp || params.size() > 0)
throw runtime_error(
"getpubkey\n"
"\nReturns the -pubkey the daemon was started with.\n"
"\nResult:\n"
"[\n"
" {\n"
" \"pubkey\" : \"pubkey\", (string) The pubkey\n"
" }\n"
"]\n"
"\nExamples:\n"
"\nList pubkey.\n"
+ HelpExampleCli("getpubkey", "")
+ HelpExampleRpc("getpubkey", "")
);
extern uint8_t NOTARY_PUBKEY33[];
extern std::string NOTARY_PUBKEY;
if ( NOTARY_PUBKEY33[0] == 0 ) {
result.push_back(Pair("error","pubkey was not set!";
} else {
result.push_back(Pair("pubkey", NOTARY_PUBKEY);
}
return result;
}
UniValue oraclesaddress(const UniValue& params, bool fHelp)
{
struct CCcontract_info *cp,C; std::vector<unsigned char> pubkey;