Skip to content

Commit 0ecc630

Browse files
committed
Merge #11594: Improve -disablewallet parameter interaction
7963335 Fix -disablewallet default value (João Barbosa) b411c2a Improve -disablewallet parameter interaction (João Barbosa) Pull request description: The first commit logs a message for each configured wallet if `-disablewallet` is set: ``` bitcoind -printtoconsole -regtest -disablewallet -wallet=foo -wallet=bar ... WalletParameterInteraction: parameter interaction: -disablewallet -> ignoring -wallet=foo WalletParameterInteraction: parameter interaction: -disablewallet -> ignoring -wallet=bar ``` It also moves up the `-disablewallet` check which avoids the unnecessary `-wallet` soft set. The second commit fixes the default value of `-disablewallet`, currently the value is correct, but it should use `DEFAULT_DISABLE_WALLET`. The third commit can be dropped or squashed, just took the opportunity to fix the coding style there. Tree-SHA512: bec13d2b2be5adf4680c77212020ed27dd05f15c4c73542d2005d91108bf704e2df1707ed2bec696e584ecd40eff7a63e25201fd70400222aa5a8da6aed6afeb
2 parents 331352f + 7963335 commit 0ecc630

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/wallet/init.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ std::string GetWalletHelpString(bool showDebug)
5353

5454
bool WalletParameterInteraction()
5555
{
56-
gArgs.SoftSetArg("-wallet", DEFAULT_WALLET_DAT);
57-
const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1;
56+
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
57+
for (const std::string& wallet : gArgs.GetArgs("-wallet")) {
58+
LogPrintf("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet);
59+
}
5860

59-
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
6061
return true;
62+
}
63+
64+
gArgs.SoftSetArg("-wallet", DEFAULT_WALLET_DAT);
65+
const bool is_multiwallet = gArgs.GetArgs("-wallet").size() > 1;
6166

6267
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && gArgs.SoftSetBoolArg("-walletbroadcast", false)) {
6368
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
@@ -173,15 +178,18 @@ bool WalletParameterInteraction()
173178

174179
void RegisterWalletRPC(CRPCTable &t)
175180
{
176-
if (gArgs.GetBoolArg("-disablewallet", false)) return;
181+
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
182+
return;
183+
}
177184

178185
RegisterWalletRPCCommands(t);
179186
}
180187

181188
bool VerifyWallets()
182189
{
183-
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
190+
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
184191
return true;
192+
}
185193

186194
uiInterface.InitMessage(_("Verifying wallet(s)..."));
187195

0 commit comments

Comments
 (0)