Skip to content

Commit 7e32b1e

Browse files
random-zebraFuzzbawls
authored andcommitted
[RPC] Add optional bool arg to listdelegators to show blacklisted addrs
Github-Pull: #1238 Rebased-From: 34e871c
1 parent 8f01bce commit 7e32b1e

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/rpc/client.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
4848
{"getreceivedbyaddress", 1},
4949
{"getreceivedbyaccount", 1},
5050
{"listcoldutxos", 0},
51+
{"listdelegators", 0},
5152
{"listreceivedbyaddress", 0},
5253
{"listreceivedbyaddress", 1},
5354
{"listreceivedbyaddress", 2},

src/wallet/rpcwallet.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,19 @@ UniValue ListaddressesForPurpose(const std::string strPurpose)
237237

238238
UniValue listdelegators(const UniValue& params, bool fHelp)
239239
{
240-
if (fHelp || params.size() != 0)
240+
if (fHelp || params.size() > 1)
241241
throw std::runtime_error(
242-
"listdelegators \"addr\"\n"
242+
"listdelegators ( fBlacklist )\n"
243243
"\nShows the list of allowed delegator addresses for cold staking.\n"
244244

245+
"\nArguments:\n"
246+
"1. fBlacklist (boolean, optional, default = false) Show addresses removed\n"
247+
" from the delegators whitelist\n"
248+
245249
"\nResult:\n"
246250
"[\n"
247251
" {\n"
248-
" \"label\": \"yyy\", (string) account label\n"
252+
" \"label\": \"yyy\", (string) account label\n"
249253
" \"address\": \"xxx\", (string) PIVX address string\n"
250254
" }\n"
251255
" ...\n"
@@ -255,7 +259,10 @@ UniValue listdelegators(const UniValue& params, bool fHelp)
255259
HelpExampleCli("listdelegators" , "") +
256260
HelpExampleRpc("listdelegators", ""));
257261

258-
return ListaddressesForPurpose("delegator");
262+
const bool fBlacklist = (params.size() > 0 ? params[0].get_bool() : false);
263+
return (fBlacklist ?
264+
ListaddressesForPurpose(AddressBook::AddressBookPurpose::DELEGABLE) :
265+
ListaddressesForPurpose(AddressBook::AddressBookPurpose::DELEGATOR));
259266
}
260267

261268
UniValue liststakingaddresses(const UniValue& params, bool fHelp)

0 commit comments

Comments
 (0)