mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Update PAK internals, helper functions
This commit is contained in:
parent
16b87ba951
commit
804cd9f75f
5 changed files with 76 additions and 187 deletions
|
|
@ -667,8 +667,7 @@ UniValue FormatPAKList(CPAKList &paklist) {
|
|||
UniValue paklist_value(UniValue::VOBJ);
|
||||
std::vector<std::vector<unsigned char> > offline_keys;
|
||||
std::vector<std::vector<unsigned char> > online_keys;
|
||||
bool is_reject;
|
||||
paklist.ToBytes(offline_keys, online_keys, is_reject);
|
||||
paklist.ToBytes(offline_keys, online_keys);
|
||||
|
||||
UniValue retOnline(UniValue::VARR);
|
||||
UniValue retOffline(UniValue::VARR);
|
||||
|
|
@ -679,7 +678,7 @@ UniValue FormatPAKList(CPAKList &paklist) {
|
|||
}
|
||||
paklist_value.pushKV("online", retOnline);
|
||||
paklist_value.pushKV("offline", retOffline);
|
||||
paklist_value.pushKV("reject", is_reject);
|
||||
paklist_value.pushKV("reject", retOffline.empty());
|
||||
return paklist_value;
|
||||
}
|
||||
|
||||
|
|
@ -688,12 +687,11 @@ UniValue getpakinfo(const JSONRPCRequest& request)
|
|||
if (request.fHelp || request.params.size() != 0)
|
||||
throw std::runtime_error(
|
||||
RPCHelpMan{"getpakinfo",
|
||||
"\nReturns relevant pegout authorization key (PAK) information about this node, both from command line arguments and blockchain data.\n",
|
||||
"\nReturns relevant pegout authorization key (PAK) information about this node, both from blockchain data.\n",
|
||||
{},
|
||||
RPCResult{
|
||||
"{\n"
|
||||
"\"config_paklist\" (array) The PAK list loaded from beta.conf at startup\n"
|
||||
"\"block_paklist\" (array) The PAK list loaded from latest block commitment\n"
|
||||
"\"block_paklist\" (array) The PAK list loaded from latest epoch\n"
|
||||
"}\n"
|
||||
},
|
||||
RPCExamples{""},
|
||||
|
|
@ -701,13 +699,9 @@ UniValue getpakinfo(const JSONRPCRequest& request)
|
|||
|
||||
LOCK(cs_main);
|
||||
|
||||
UniValue paklist_value(UniValue::VOBJ);
|
||||
if (g_paklist_config) {
|
||||
paklist_value = FormatPAKList(*g_paklist_config);
|
||||
}
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.pushKV("config_paklist", paklist_value);
|
||||
ret.pushKV("block_paklist", FormatPAKList(g_paklist_blockchain));
|
||||
CPAKList paklist = GetActivePAKList(chainActive.Tip(), Params().GetConsensus());
|
||||
ret.pushKV("block_paklist", FormatPAKList(paklist));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue