@@ -143,31 +143,35 @@ UniValue getnewstakingaddress(const UniValue& params, bool fHelp)
143143
144144UniValue delegatoradd (const UniValue& params, bool fHelp )
145145{
146- if (fHelp || params.size () != 1 )
146+ if (fHelp || params.size () < 1 || params. size () > 2 )
147147 throw std::runtime_error (
148- " delegatoradd \" addr\"\n "
148+ " delegatoradd \" addr\" ( \" label \" ) \n "
149149 " \n Add the provided address <addr> into the allowed delegators AddressBook.\n "
150150 " This enables the staking of coins delegated to this wallet, owned by <addr>\n "
151151
152152 " \n Arguments:\n "
153153 " 1. \" addr\" (string, required) The address to whitelist\n "
154+ " 2. \" label\" (string, optional) A label for the address to whitelist\n "
154155
155156 " \n Result:\n "
156157 " true|false (boolean) true if successful.\n "
157158
158159 " \n Examples:\n " +
159160 HelpExampleCli (" delegatoradd" , " DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6" ) +
160- HelpExampleRpc (" delegatoradd" , " \" DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" " ));
161+ HelpExampleRpc (" delegatoradd" , " \" DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" " ) +
162+ HelpExampleRpc (" delegatoradd" , " \" DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \" myPaperWallet\" " ));
161163
162164 CBitcoinAddress address (params[0 ].get_str ());
163165 if (!address.IsValid () || address.IsStakingAddress ())
164166 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Invalid PIVX address" );
165167
168+ const std::string strLabel = (params.size () > 1 ? params[1 ].get_str () : " " );
169+
166170 CKeyID keyID;
167171 if (!address.GetKeyID (keyID))
168172 throw JSONRPCError (RPC_INVALID_ADDRESS_OR_KEY, " Unable to get KeyID from PIVX address" );
169173
170- return pwalletMain->SetAddressBook (keyID, " " , AddressBook::AddressBookPurpose::DELEGATOR);
174+ return pwalletMain->SetAddressBook (keyID, strLabel , AddressBook::AddressBookPurpose::DELEGATOR);
171175}
172176
173177UniValue delegatorremove (const UniValue& params, bool fHelp )
@@ -179,7 +183,7 @@ UniValue delegatorremove(const UniValue& params, bool fHelp)
179183 " This disables the staking of coins delegated to this wallet, owned by <addr>\n "
180184
181185 " \n Arguments:\n "
182- " 1. \" addr\" (string, required) The address to whitelist \n "
186+ " 1. \" addr\" (string, required) The address to blacklist \n "
183187
184188 " \n Result:\n "
185189 " true|false (boolean) true if successful.\n "
0 commit comments