Skip to content

Commit

Permalink
Rename RPC getfundingaddress to getpeginaddress for clarity
Browse files Browse the repository at this point in the history
Improve the help text to better explain what the command does, and how
`getfundingaddress` parallels `getaddress` in necessitating regular backup
of wallet.dat.
  • Loading branch information
wtogami authored and instagibbs committed Jun 15, 2017
1 parent 201a189 commit 3ccf1a2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3151,27 +3151,29 @@ CScriptID calculate_contract(const CScript& federationRedeemScript, const CBitco
return CScriptID(scriptDestination);
}

UniValue getfundingaddress(const JSONRPCRequest& request)
UniValue getpeginaddress(const JSONRPCRequest& request)
{
if (!EnsureWalletIsAvailable(request.fHelp))
return NullUniValue;

if (request.fHelp || request.params.size() > 1)
throw std::runtime_error(
"getfundingaddress ( \"account\" )\n"
"\nReturns information necessary to complete withdraw steps to alpha sidechain.\n"
"getpeginaddress ( \"account\" )\n"
"\nReturns information needed for claimpegin to move coins to the sidechain.\n"
"The user should send coins from their Bitcoin wallet to the mainaddress returned.\n"
"IMPORTANT: Like getaddress, getpeginaddress adds new secrets to wallet.dat, necessitating backup on a regular basis.\n"

"\nArguments:\n"
"1. \"account\" (string, optional) The account name for the address to be linked to. if not provided, the default account \"\" is used. It can also be set to the empty string \"\" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name.\n"
"\nResult:\n"
"\"nonce\" (string) Nonce used for sidechain withdrawout step\n"
"\"mainaddress\" (string) Mainchain Deposit Address\n"
"\"address\" (string) The newly created address to which coins will be sent on the sidechain\n"
"\nExamples:\n"
+ HelpExampleCli("getfundingaddress", "")
+ HelpExampleCli("getfundingaddress", "\"\"")
+ HelpExampleCli("getfundingaddress", "\"myaccount\"")
+ HelpExampleRpc("getfundingaddress", "\"myaccount\"")
+ HelpExampleCli("getpeginaddress", "")
+ HelpExampleCli("getpeginaddress", "\"\"")
+ HelpExampleCli("getpeginaddress", "\"myaccount\"")
+ HelpExampleRpc("getpeginaddress", "\"myaccount\"")
);

//Creates new address for later receipt of final funds in spendclaim
Expand Down Expand Up @@ -3275,9 +3277,9 @@ UniValue claimpegin(const JSONRPCRequest& request)
"Note that the transaction will not be mined or relayed unless it is buried at least 10 blocks deep.\n"
"If a transaction is not relayed it may require manual addition to a functionary mempool in order for it to be mined.\n"
"\nArguments:\n"
"1. \"sidechainaddress\" (string, required) The sidechain address address generated by getfundingaddress\n"
"2. \"nonce\" (string, required) The nonce generated by getfundingaddress\n"
"3. \"bitcoinTx\" (string, required) The raw bitcoin transaction (in hex) depositing bitcoin to the mainaddress generated by getfundingaddress\n"
"1. \"sidechainaddress\" (string, required) The sidechain address address generated by getpeginaddress\n"
"2. \"nonce\" (string, required) The nonce generated by getpeginaddress\n"
"3. \"bitcoinTx\" (string, required) The raw bitcoin transaction (in hex) depositing bitcoin to the mainaddress generated by getpeginaddress\n"
"4. \"txoutproof\" (string, required) A rawtxoutproof (in hex) generated by bitcoind's `gettxoutproof` containing a proof of only bitcoinTx\n"
"\nResult:\n"
"\"txid\" (string) Txid of the resulting sidechain transaction\n"
Expand Down Expand Up @@ -3328,7 +3330,7 @@ UniValue claimpegin(const JSONRPCRequest& request)
if (txBTC.vout[nOut].scriptPubKey == mainchain_script)
break;
if (nOut == txBTC.vout.size())
throw JSONRPCError(RPC_INVALID_PARAMETER, "Failed to find output in bitcoinTx to the mainaddress from getfundingaddress");
throw JSONRPCError(RPC_INVALID_PARAMETER, "Failed to find output in bitcoinTx to the mainaddress from getpeginaddress");
CAmount value = txBTC.vout[nOut].nValue.GetAmount();

//Output we're re-locking
Expand Down Expand Up @@ -3439,7 +3441,7 @@ static const CRPCCommand commands[] =
{ "wallet", "getbalance", &getbalance, false, {"account","minconf","include_watchonly"} },
{ "wallet", "getnewaddress", &getnewaddress, true, {"account"} },
{ "wallet", "getrawchangeaddress", &getrawchangeaddress, true, {} },
{ "wallet", "getfundingaddress", &getfundingaddress, false, {} },
{ "wallet", "getpeginaddress", &getpeginaddress, false, {} },
{ "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false, {"account","minconf"} },
{ "wallet", "getreceivedbyaddress", &getreceivedbyaddress, false, {"address","minconf"} },
{ "wallet", "gettransaction", &gettransaction, false, {"txid","include_watchonly"} },
Expand Down

0 comments on commit 3ccf1a2

Please sign in to comment.