Skip to content

Truthier error message when rpcpassword is missing#5318

Merged
laanwj merged 1 commit intobitcoin:masterfrom
gwillen:master
Nov 21, 2014
Merged

Truthier error message when rpcpassword is missing#5318
laanwj merged 1 commit intobitcoin:masterfrom
gwillen:master

Conversation

@gwillen
Copy link
Copy Markdown
Contributor

@gwillen gwillen commented Nov 19, 2014

See #5178 -- this change makes the error slightly more honest / less confusing. The message was always being displayed as "To use the -server option". The check for "-server" did not work as intended, because SoftSetBoolArg is used to enable -server anytime we run as bitcoind, so there's no way for this code to tell whether -server was actually passed by the user or not.

If there's some nice way to tell whether we're bitcoind or bitcoin-core, we could customize the error message accordingly; but it's probably not worth adding code in order to do that, so I've made a single error message that covers both.

I have removed all references to -daemon because as far as I can tell that flag has no effect on whether RPC is enabled or not. (RPC-enabling happens only on init.cpp:768, as far as I can tell, and is conditional only on whether -server is set, which happens if the user passes "-server", or if we are bitcoind. I couldn't find any way for -daemon to affect this.)

Previously, one of the possible messages was localized and the other was not. I have left the message localized, but I don't know what else I might need to touch since I changed it. (gmaxwell opined to me that it's better not to localize error messages at all; I'm happy to remove that here if it's undesired.)

@sipa
Copy link
Copy Markdown
Member

sipa commented Nov 19, 2014

Nit: 'bitcoin-core' isn't very well defined, and if it is, it already includes bitcoind. Writing bitcoin-qt would be more correct.

@gwillen
Copy link
Copy Markdown
Contributor Author

gwillen commented Nov 19, 2014

@sipa Fixed, thanks. (Is best practice around here to push another commit to the PR, or replace my old commit?)

@sipa
Copy link
Copy Markdown
Member

sipa commented Nov 19, 2014

You can update your old commit. Unless there are significant portions of finished and reviewed work, but you're just adding something mostly independent.

@gmaxwell
Copy link
Copy Markdown
Contributor

A unifide error message is also better because it's more easily found via search. ACK.

Comment thread src/rpcserver.cpp
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest: To use bitcoind, or the -server option with bitcoin-qt.
Perhaps also bitcoin-qt should be replaced by Bitcoin Core GUI?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO authors choice here, but I think to is more pedantically correct than with. (-server isn't actually an option to bitcoind and it kind of makes it sould like you have the option of bitcoind without -server in that clause).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: -server is an option to bitcoind: you can do -server=0 to run without RPC

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could reword it to "To use bitcoind, or 'bitcoin-qt -server'", to use fewer and perhaps clearer words. (That's assuming that the binary can be invoked as bitcoin-qt on all platforms; I don't know how you invoke it on windows. I don't know that it makes sense to say Bitcoin Core Gui, since anybody who's passing commandline arguments to it will be familiar with the name of the binary.)

(I'm assuming the nit was directed purely at gmaxwell; the -server option to bitcoind isn't relevant to the wording of this error message, I think.)

Failing that, I think I'll just stick with my original wording barring major objections.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the point of the nit is that potentially you could bypass the rpc password requirement by running bitcoind -server=0 ... not that doing so is all that useful. It's a pretty bad configuration though, since you have no way to cleanly shut down the daemon even. :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

killall -SIGINT bitcoind shuts down cleanly, afaik.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stand corrected. (I think it should be TERM, since a unix norm is to term then kill, but I don't think we reliably shutdown fast enough for that to help)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shutdown on either of them.

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Nov 21, 2014

And it makes the code simpler too! great,
Tested ACK 77c38bb https://dev.visucore.com/bitcoin/acks/5318

@laanwj laanwj merged commit 77c38bb into bitcoin:master Nov 21, 2014
laanwj added a commit that referenced this pull request Nov 21, 2014
77c38bb Truthier error message when rpcpassword is missing (Glenn Willen)
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants