5460460 Add AbsPathForConfigVal to consolidate datadir prefixing for path args (James O'Beirne)
a1e1305 Clarify help messages for path args to mention datadir prefix (James O'Beirne)
Pull request description:
Change `-conf`'s help message to indicate that relative path values will be prefixed by the datadir path. This behavior probably merits clarification; it's kind of confusing when attempting to specify a configuration file in the current directory with `-conf=bitcoin.conf`, but instead loading the `bitcoin.conf` file in ~/.bitcoin datadir.
### Edit
This PR has been modified to document all cases where relative path configurations are modified to be under datadir. A small refactoring has also been added which consolidates this normalization.
Tree-SHA512: be4fc0595fbeba33d17af08f59898af45e76a44f00719ea0282403b155ac6755584604fab765250a3aa14ed6991882c4d1ccbe601184362c5ba97c886bdda344
strUsage+=HelpMessageOpt("-conf=<file>",strprintf(_("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)"),BITCOIN_CONF_FILENAME));
strUsage+=HelpMessageOpt("-datadir=<dir>",_("Specify data directory"));
strUsage+=HelpMessageOpt("-datadir=<dir>",_("Specify data directory"));
strUsage+=HelpMessageOpt("-getinfo",_("Get general information from the remote server. Note that unlike server-side RPC calls, the results of -getinfo is the result of multiple non-atomic requests. Some entries in the result may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)"));
strUsage+=HelpMessageOpt("-getinfo",_("Get general information from the remote server. Note that unlike server-side RPC calls, the results of -getinfo is the result of multiple non-atomic requests. Some entries in the result may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)"));
strUsage+=HelpMessageOpt("-blockreconstructionextratxn=<n>",strprintf(_("Extra transactions to keep in memory for compact block reconstructions (default: %u)"),DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN));
strUsage+=HelpMessageOpt("-blockreconstructionextratxn=<n>",strprintf(_("Extra transactions to keep in memory for compact block reconstructions (default: %u)"),DEFAULT_BLOCK_RECONSTRUCTION_EXTRA_TXN));
if(showDebug)
if(showDebug)
strUsage+=HelpMessageOpt("-blocksonly",strprintf(_("Whether to operate in a blocks only mode (default: %u)"),DEFAULT_BLOCKSONLY));
strUsage+=HelpMessageOpt("-blocksonly",strprintf(_("Whether to operate in a blocks only mode (default: %u)"),DEFAULT_BLOCKSONLY));
strUsage+=HelpMessageOpt("-conf=<file>",strprintf(_("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)"),BITCOIN_CONF_FILENAME));
strUsage+=HelpMessageOpt("-dbbatchsize",strprintf("Maximum database write batch size in bytes (default: %u)",nDefaultDbBatchSize));
strUsage+=HelpMessageOpt("-dbbatchsize",strprintf("Maximum database write batch size in bytes (default: %u)",nDefaultDbBatchSize));
}
}
strUsage+=HelpMessageOpt("-dbcache=<n>",strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"),nMinDbCache,nMaxDbCache,nDefaultDbCache));
strUsage+=HelpMessageOpt("-dbcache=<n>",strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"),nMinDbCache,nMaxDbCache,nDefaultDbCache));
strUsage+=HelpMessageOpt("-debuglogfile=<file>",strprintf(_("Specify location of debug log file: this can be an absolute path or a path relative to the data directory (default: %s)"),DEFAULT_DEBUGLOGFILE));
strUsage+=HelpMessageOpt("-debuglogfile=<file>",strprintf(_("Specify location of debug log file. Relative paths will be prefixed by a net-specific datadir location. (default: %s)"),DEFAULT_DEBUGLOGFILE));
if(showDebug)
if(showDebug)
strUsage+=HelpMessageOpt("-feefilter",strprintf("Tell other nodes to filter invs to us by our mempool min fee (default: %u)",DEFAULT_FEEFILTER));
strUsage+=HelpMessageOpt("-feefilter",strprintf("Tell other nodes to filter invs to us by our mempool min fee (default: %u)",DEFAULT_FEEFILTER));
strUsage+=HelpMessageOpt("-loadblock=<file>",_("Imports blocks from external blk000??.dat file on startup"));
strUsage+=HelpMessageOpt("-loadblock=<file>",_("Imports blocks from external blk000??.dat file on startup"));
strUsage+=HelpMessageOpt("-persistmempool",strprintf(_("Whether to save the mempool on shutdown and load on restart (default: %u)"),DEFAULT_PERSIST_MEMPOOL));
strUsage+=HelpMessageOpt("-persistmempool",strprintf(_("Whether to save the mempool on shutdown and load on restart (default: %u)"),DEFAULT_PERSIST_MEMPOOL));
strUsage+=HelpMessageOpt("-pid=<file>",strprintf(_("Specify pid file. Relative paths will be prefixed by a net-specific datadir location. (default: %s)"),BITCOIN_PID_FILENAME));
#endif
#endif
strUsage+=HelpMessageOpt("-prune=<n>",strprintf(_("Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex and -rescan. "
strUsage+=HelpMessageOpt("-prune=<n>",strprintf(_("Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex and -rescan. "
"Warning: Reverting this setting requires re-downloading the entire blockchain. "
"Warning: Reverting this setting requires re-downloading the entire blockchain. "
strUsage+=HelpMessageOpt("-rpcallowip=<ip>",_("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
strUsage+=HelpMessageOpt("-rpcallowip=<ip>",_("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
strUsage+=HelpMessageOpt("-rpcauth=<userpw>",_("Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times"));
strUsage+=HelpMessageOpt("-rpcauth=<userpw>",_("Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times"));
strUsage+=HelpMessageOpt("-rpcbind=<addr>[:port]",_("Bind to given address to listen for JSON-RPC connections. This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)"));
strUsage+=HelpMessageOpt("-rpcbind=<addr>[:port]",_("Bind to given address to listen for JSON-RPC connections. This option is ignored unless -rpcallowip is also passed. Port is optional and overrides -rpcport. Use [host]:port notation for IPv6. This option can be specified multiple times (default: 127.0.0.1 and ::1 i.e., localhost, or if -rpcallowip has been specified, 0.0.0.0 and :: i.e., all addresses)"));
strUsage+=HelpMessageOpt("-rpccookiefile=<loc>",_("Location of the auth cookie (default: data dir)"));
strUsage+=HelpMessageOpt("-rpccookiefile=<loc>",_("Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)"));
strUsage+=HelpMessageOpt("-rpcpassword=<pw>",_("Password for JSON-RPC connections"));
strUsage+=HelpMessageOpt("-rpcpassword=<pw>",_("Password for JSON-RPC connections"));
strUsage+=HelpMessageOpt("-rpcport=<port>",strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"),defaultBaseParams->RPCPort(),testnetBaseParams->RPCPort()));
strUsage+=HelpMessageOpt("-rpcport=<port>",strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"),defaultBaseParams->RPCPort(),testnetBaseParams->RPCPort()));
strUsage+=HelpMessageOpt("-rpcserialversion",strprintf(_("Sets the serialization of raw transaction or block hex returned in non-verbose mode, non-segwit(0) or segwit(1) (default: %d)"),DEFAULT_RPC_SERIALIZE_VERSION));
strUsage+=HelpMessageOpt("-rpcserialversion",strprintf(_("Sets the serialization of raw transaction or block hex returned in non-verbose mode, non-segwit(0) or segwit(1) (default: %d)"),DEFAULT_RPC_SERIALIZE_VERSION));