-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error if relative -walletdir is specified #12220
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,11 +205,15 @@ bool VerifyWallets() | |
return true; | ||
} | ||
|
||
if (gArgs.IsArgSet("-walletdir") && !fs::is_directory(GetWalletDir())) { | ||
if (fs::exists(fs::system_complete(gArgs.GetArg("-walletdir", "")))) { | ||
return InitError(strprintf(_("Specified -walletdir \"%s\" is not a directory"), gArgs.GetArg("-walletdir", "").c_str())); | ||
if (gArgs.IsArgSet("-walletdir")) { | ||
fs::path wallet_dir = gArgs.GetArg("-walletdir", ""); | ||
if (!fs::exists(wallet_dir)) { | ||
return InitError(strprintf(_("Specified -walletdir \"%s\" does not exist"), wallet_dir.string())); | ||
} else if (!fs::is_directory(wallet_dir)) { | ||
return InitError(strprintf(_("Specified -walletdir \"%s\" is not a directory"), wallet_dir.string())); | ||
} else if (!wallet_dir.is_absolute()) { | ||
return InitError(strprintf(_("Specified -walletdir \"%s\" is a relative path"), wallet_dir.string())); | ||
} | ||
return InitError(strprintf(_("Specified -walletdir \"%s\" does not exist"), gArgs.GetArg("-walletdir", "").c_str())); | ||
} | ||
|
||
LogPrintf("Using wallet directory %s\n", GetWalletDir().string()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Could remove call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not sure it was necessary to begin with, but now removed in 46c40bf. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes slightly more sense to me to have this as the first check, ie we should error out immediately if the user has provided a relative path, rather than first checking whether it exists and is a directory. Is there any particular reason that you've placed this as the last check?