Skip to content

Commit e47af54

Browse files
committed
scripted-diff: prefix [address|change]type parameters with 'default'
Making it clear that these parameters can be overridden by individual wallet commands. -BEGIN VERIFY SCRIPT- sed -i 's/addresstype/defaultaddresstype/g' doc/*.md src/wallet/*.cpp test/functional/*.py sed -i 's/changetype/defaultchangetype/g' doc/*.md src/wallet/*.cpp test/functional/*.py -END VERIFY SCRIPT-
1 parent 17180fa commit e47af54

File tree

12 files changed

+22
-22
lines changed

12 files changed

+22
-22
lines changed

doc/release-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Low-level RPC changes
9898
* `getmininginfo`
9999
- The wallet RPC `getreceivedbyaddress` will return an error if called with an address not in the wallet.
100100
- The wallet RPC `addwitnessaddress` was deprecated and will be removed in version 0.17,
101-
set the `address_type` argument of `getnewaddress`, or option `-addresstype=[bech32|p2sh-segwit]` instead.
101+
set the `address_type` argument of `getnewaddress`, or option `-defaultaddresstype=[bech32|p2sh-segwit]` instead.
102102

103103
Changed command-line options
104104
-----------------------------

src/wallet/init.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
std::string GetWalletHelpString(bool showDebug)
1717
{
1818
std::string strUsage = HelpMessageGroup(_("Wallet options:"));
19-
strUsage += HelpMessageOpt("-addresstype", strprintf(_("What type of addresses to use (\"legacy\", \"p2sh-segwit\", or \"bech32\", default: \"%s\")"), FormatOutputType(OUTPUT_TYPE_DEFAULT)));
20-
strUsage += HelpMessageOpt("-changetype", _("What type of change to use (\"legacy\", \"p2sh-segwit\", or \"bech32\", default is same as -addresstype)"));
19+
strUsage += HelpMessageOpt("-defaultaddresstype", strprintf(_("What type of addresses to use (\"legacy\", \"p2sh-segwit\", or \"bech32\", default: \"%s\")"), FormatOutputType(OUTPUT_TYPE_DEFAULT)));
20+
strUsage += HelpMessageOpt("-defaultchangetype", _("What type of change to use (\"legacy\", \"p2sh-segwit\", or \"bech32\", default is same as -defaultaddresstype)"));
2121
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
2222
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), DEFAULT_KEYPOOL_SIZE));
2323
strUsage += HelpMessageOpt("-fallbackfee=<amt>", strprintf(_("A fee rate (in %s/kB) that will be used when fee estimation has insufficient data (default: %s)"),
@@ -177,14 +177,14 @@ bool WalletParameterInteraction()
177177
bSpendZeroConfChange = gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
178178
fWalletRbf = gArgs.GetBoolArg("-walletrbf", DEFAULT_WALLET_RBF);
179179

180-
g_address_type = ParseOutputType(gArgs.GetArg("-addresstype", ""));
180+
g_address_type = ParseOutputType(gArgs.GetArg("-defaultaddresstype", ""));
181181
if (g_address_type == OUTPUT_TYPE_NONE) {
182-
return InitError(strprintf(_("Unknown address type '%s'"), gArgs.GetArg("-addresstype", "")));
182+
return InitError(strprintf(_("Unknown address type '%s'"), gArgs.GetArg("-defaultaddresstype", "")));
183183
}
184184

185-
g_change_type = ParseOutputType(gArgs.GetArg("-changetype", ""), g_address_type);
185+
g_change_type = ParseOutputType(gArgs.GetArg("-defaultchangetype", ""), g_address_type);
186186
if (g_change_type == OUTPUT_TYPE_NONE) {
187-
return InitError(strprintf(_("Unknown change type '%s'"), gArgs.GetArg("-changetype", "")));
187+
return InitError(strprintf(_("Unknown change type '%s'"), gArgs.GetArg("-defaultchangetype", "")));
188188
}
189189

190190
return true;

src/wallet/rpcwallet.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ UniValue getnewaddress(const JSONRPCRequest& request)
144144
"so payments received with the address will be credited to 'account'.\n"
145145
"\nArguments:\n"
146146
"1. \"account\" (string, optional) DEPRECATED. 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"
147-
"2. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -addresstype.\n"
147+
"2. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -defaultaddresstype.\n"
148148
"\nResult:\n"
149149
"\"address\" (string) The new bitcoin address\n"
150150
"\nExamples:\n"
@@ -242,7 +242,7 @@ UniValue getrawchangeaddress(const JSONRPCRequest& request)
242242
"\nReturns a new Bitcoin address, for receiving change.\n"
243243
"This is for use with raw transactions, NOT normal use.\n"
244244
"\nArguments:\n"
245-
"1. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -changetype.\n"
245+
"1. \"address_type\" (string, optional) The address type to use. Options are \"legacy\", \"p2sh-segwit\", and \"bech32\". Default is set by -defaultchangetype.\n"
246246
"\nResult:\n"
247247
"\"address\" (string) The address\n"
248248
"\nExamples:\n"
@@ -1285,7 +1285,7 @@ UniValue addwitnessaddress(const JSONRPCRequest& request)
12851285
if (request.fHelp || request.params.size() < 1 || request.params.size() > 2)
12861286
{
12871287
std::string msg = "addwitnessaddress \"address\" ( p2sh )\n"
1288-
"\nDEPRECATED: set the address_type argument of getnewaddress, or option -addresstype=[bech32|p2sh-segwit] instead.\n"
1288+
"\nDEPRECATED: set the address_type argument of getnewaddress, or option -defaultaddresstype=[bech32|p2sh-segwit] instead.\n"
12891289
"Add a witness address for a script (with pubkey or redeemscript known). Requires a new wallet backup.\n"
12901290
"It returns the witness script.\n"
12911291

@@ -1303,7 +1303,7 @@ UniValue addwitnessaddress(const JSONRPCRequest& request)
13031303
if (!IsDeprecatedRPCEnabled("addwitnessaddress")) {
13041304
throw JSONRPCError(RPC_METHOD_DEPRECATED, "addwitnessaddress is deprecated and will be fully removed in v0.17. "
13051305
"To use addwitnessaddress in v0.16, restart bitcoind with -deprecatedrpc=addwitnessaddress.\n"
1306-
"Projects should transition to using the address_type argument of getnewaddress, or option -addresstype=[bech32|p2sh-segwit] instead.\n");
1306+
"Projects should transition to using the address_type argument of getnewaddress, or option -defaultaddresstype=[bech32|p2sh-segwit] instead.\n");
13071307
}
13081308

13091309
{

test/functional/address_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
class AddressTypeTest(BitcoinTestFramework):
3636
def set_test_params(self):
3737
self.num_nodes = 5
38-
self.extra_args = [["-addresstype=legacy"], ["-addresstype=p2sh-segwit"], ["-addresstype=p2sh-segwit", "-changetype=bech32"], ["-addresstype=bech32"], []]
38+
self.extra_args = [["-defaultaddresstype=legacy"], ["-defaultaddresstype=p2sh-segwit"], ["-defaultaddresstype=p2sh-segwit", "-defaultchangetype=bech32"], ["-defaultaddresstype=bech32"], []]
3939

4040
def setup_network(self):
4141
self.setup_nodes()

test/functional/bip68-112-113-p2p.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class BIP68_112_113Test(ComparisonTestFramework):
9595
def set_test_params(self):
9696
self.num_nodes = 1
9797
self.setup_clean_chain = True
98-
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', '-addresstype=legacy']]
98+
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', '-defaultaddresstype=legacy']]
9999

100100
def run_test(self):
101101
test = TestManager(self, self.options.tmpdir)

test/functional/import-rescan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def set_test_params(self):
119119
self.num_nodes = 2 + len(IMPORT_NODES)
120120

121121
def setup_network(self):
122-
extra_args = [["-addresstype=legacy"] for _ in range(self.num_nodes)]
122+
extra_args = [["-defaultaddresstype=legacy"] for _ in range(self.num_nodes)]
123123
for i, import_node in enumerate(IMPORT_NODES, 2):
124124
if import_node.prune:
125125
extra_args[i] += ["-prune=1"]

test/functional/importmulti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class ImportMultiTest (BitcoinTestFramework):
1010
def set_test_params(self):
1111
self.num_nodes = 2
12-
self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"]]
12+
self.extra_args = [["-defaultaddresstype=legacy"], ["-defaultaddresstype=legacy"]]
1313
self.setup_clean_chain = True
1414

1515
def setup_network(self):

test/functional/nulldummy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def set_test_params(self):
4242
self.setup_clean_chain = True
4343
# This script tests NULLDUMMY activation, which is part of the 'segwit' deployment, so we go through
4444
# normal segwit activation here (and don't use the default always-on behaviour).
45-
self.extra_args = [['-whitelist=127.0.0.1', '-walletprematurewitness', '-vbparams=segwit:0:999999999999', '-addresstype=legacy', "-deprecatedrpc=addwitnessaddress"]]
45+
self.extra_args = [['-whitelist=127.0.0.1', '-walletprematurewitness', '-vbparams=segwit:0:999999999999', '-defaultaddresstype=legacy', "-deprecatedrpc=addwitnessaddress"]]
4646

4747
def run_test(self):
4848
self.address = self.nodes[0].getnewaddress()

test/functional/rawtransactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class RawTransactionsTest(BitcoinTestFramework):
3939
def set_test_params(self):
4040
self.setup_clean_chain = True
4141
self.num_nodes = 3
42-
self.extra_args = [["-addresstype=legacy"], ["-addresstype=legacy"], ["-addresstype=legacy"]]
42+
self.extra_args = [["-defaultaddresstype=legacy"], ["-defaultaddresstype=legacy"], ["-defaultaddresstype=legacy"]]
4343

4444
def setup_network(self, split=False):
4545
super().setup_network()

test/functional/segwit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def set_test_params(self):
4040
self.setup_clean_chain = True
4141
self.num_nodes = 3
4242
# This test tests SegWit both pre and post-activation, so use the normal BIP9 activation.
43-
self.extra_args = [["-walletprematurewitness", "-rpcserialversion=0", "-vbparams=segwit:0:999999999999", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"],
44-
["-blockversion=4", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness", "-rpcserialversion=1", "-vbparams=segwit:0:999999999999", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"],
45-
["-blockversion=536870915", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness", "-vbparams=segwit:0:999999999999", "-addresstype=legacy", "-deprecatedrpc=addwitnessaddress"]]
43+
self.extra_args = [["-walletprematurewitness", "-rpcserialversion=0", "-vbparams=segwit:0:999999999999", "-defaultaddresstype=legacy", "-deprecatedrpc=addwitnessaddress"],
44+
["-blockversion=4", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness", "-rpcserialversion=1", "-vbparams=segwit:0:999999999999", "-defaultaddresstype=legacy", "-deprecatedrpc=addwitnessaddress"],
45+
["-blockversion=536870915", "-promiscuousmempoolflags=517", "-prematurewitness", "-walletprematurewitness", "-vbparams=segwit:0:999999999999", "-defaultaddresstype=legacy", "-deprecatedrpc=addwitnessaddress"]]
4646

4747
def setup_network(self):
4848
super().setup_network()

0 commit comments

Comments
 (0)