191 | @@ -191,7 +192,9 @@ static void http_error_cb(enum evhttp_request_error err, void *ctx)
192 |
193 | UniValue CallRPC(const std::string& strMethod, const UniValue& params)
194 | {
195 | - std::string host = GetArg("-rpcconnect", DEFAULT_RPCCONNECT);
196 | + std::string host;
197 | + int dummy_port;
198 | + SplitHostPort(GetArg("-rpcconnect", DEFAULT_RPCCONNECT), dummy_port, host);
If you're going to do this anyway, why not allow overriding the port? (e.g. pass port instead of dummy_port, to make it possible to override the rpcport)
After all, the point of bracketed addresses is to allow [ip]:port specifications unambigiously.
I chose not to allow overriding the port since we already have the -rpcport option, and this is the minimal functional change.
I'm equally happy to make the one-line change so -rpcconnect can accept <address>:<port>. I have zero preference either way and I'm happy to go along with consensus opinion. @theuni has already expressed slight preference for allowing a port number in -rpcconnect.
I'd really prefer to be able to override the port in rpcconnect.
FYI we have a similar thing at the server side with bind which can either take a address and port (overriding -port) or just an address (in which case -port is used).
If not I'd rather NACK this. It is just confusing to parse an [ip]:port spec if you're going to ignore the port.
sure - changed to use the port from -rpcconnect if it's specified.
It was a bit more than a one line change because it was a little fiddly to get the precedence correct:
- -rpcport if there is one; else
- port in -rpcconnect if there is one; else
- default port for the chain