Un-expose mapArgs from utils.h
This commit is contained in:
parent
71fde5563b
commit
4cd373aea8
14 changed files with 30 additions and 24 deletions
|
@ -95,7 +95,7 @@ static int AppInitRPC(int argc, char* argv[])
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false))) {
|
if (!boost::filesystem::is_directory(GetDataDir(false))) {
|
||||||
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
|
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -211,7 +211,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params)
|
||||||
|
|
||||||
// Get credentials
|
// Get credentials
|
||||||
std::string strRPCUserColonPass;
|
std::string strRPCUserColonPass;
|
||||||
if (mapArgs["-rpcpassword"] == "") {
|
if (GetArg("-rpcpassword", "") == "") {
|
||||||
// Try fall back to cookie-based authentication if no password is provided
|
// Try fall back to cookie-based authentication if no password is provided
|
||||||
if (!GetAuthCookie(&strRPCUserColonPass)) {
|
if (!GetAuthCookie(&strRPCUserColonPass)) {
|
||||||
throw std::runtime_error(strprintf(
|
throw std::runtime_error(strprintf(
|
||||||
|
@ -220,7 +220,7 @@ UniValue CallRPC(const std::string& strMethod, const UniValue& params)
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
|
strRPCUserColonPass = GetArg("-rpcuser", "") + ":" + GetArg("-rpcpassword", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct evkeyvalq *output_headers = evhttp_request_get_output_headers(req);
|
struct evkeyvalq *output_headers = evhttp_request_get_output_headers(req);
|
||||||
|
|
|
@ -99,7 +99,7 @@ bool AppInit(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
|
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", GetArg("-datadir", "").c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
|
|
|
@ -215,7 +215,7 @@ static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
|
||||||
|
|
||||||
static bool InitRPCAuthentication()
|
static bool InitRPCAuthentication()
|
||||||
{
|
{
|
||||||
if (mapArgs["-rpcpassword"] == "")
|
if (GetArg("-rpcpassword", "") == "")
|
||||||
{
|
{
|
||||||
LogPrintf("No rpcpassword set - using random cookie authentication\n");
|
LogPrintf("No rpcpassword set - using random cookie authentication\n");
|
||||||
if (!GenerateAuthCookie(&strRPCUserColonPass)) {
|
if (!GenerateAuthCookie(&strRPCUserColonPass)) {
|
||||||
|
@ -226,7 +226,7 @@ static bool InitRPCAuthentication()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.\n");
|
LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.\n");
|
||||||
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
|
strRPCUserColonPass = GetArg("-rpcuser", "") + ":" + GetArg("-rpcpassword", "");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -962,8 +962,8 @@ bool AppInitParameterInteraction()
|
||||||
if (IsArgSet("-minrelaytxfee"))
|
if (IsArgSet("-minrelaytxfee"))
|
||||||
{
|
{
|
||||||
CAmount n = 0;
|
CAmount n = 0;
|
||||||
if (!ParseMoney(mapArgs["-minrelaytxfee"], n) || 0 == n)
|
if (!ParseMoney(GetArg("-minrelaytxfee", ""), n) || 0 == n)
|
||||||
return InitError(AmountErrMsg("minrelaytxfee", mapArgs["-minrelaytxfee"]));
|
return InitError(AmountErrMsg("minrelaytxfee", GetArg("-minrelaytxfee", "")));
|
||||||
// High fee check is done afterward in CWallet::ParameterInteraction()
|
// High fee check is done afterward in CWallet::ParameterInteraction()
|
||||||
::minRelayTxFee = CFeeRate(n);
|
::minRelayTxFee = CFeeRate(n);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1060,7 +1060,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||||
unsigned int nMaxSendBufferSize = connman.GetSendBufferSize();
|
unsigned int nMaxSendBufferSize = connman.GetSendBufferSize();
|
||||||
|
|
||||||
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
|
LogPrint("net", "received: %s (%u bytes) peer=%d\n", SanitizeString(strCommand), vRecv.size(), pfrom->id);
|
||||||
if (IsArgSet("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
|
if (IsArgSet("-dropmessagestest") && GetRand(GetArg("-dropmessagestest", 0)) == 0)
|
||||||
{
|
{
|
||||||
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
LogPrintf("dropmessagestest DROPPING RECV MESSAGE\n");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -604,7 +604,7 @@ int main(int argc, char *argv[])
|
||||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
|
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME),
|
||||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
|
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(GetArg("-datadir", ""))));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -36,7 +36,7 @@ OptionsModel::OptionsModel(QObject *parent, bool resetSettings) :
|
||||||
|
|
||||||
void OptionsModel::addOverriddenOption(const std::string &option)
|
void OptionsModel::addOverriddenOption(const std::string &option)
|
||||||
{
|
{
|
||||||
strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(mapArgs[option]) + " ";
|
strOverriddenByCommandLine += QString::fromStdString(option) + "=" + QString::fromStdString(GetArg(option, "")) + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Writes all missing QSettings with their default values
|
// Writes all missing QSettings with their default values
|
||||||
|
@ -464,4 +464,4 @@ void OptionsModel::checkAndMigrate()
|
||||||
|
|
||||||
settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
|
settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
|
extern std::map<std::string, std::string> mapArgs;
|
||||||
|
|
||||||
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
|
static UniValue rpcNestedTest_rpc(const JSONRPCRequest& request)
|
||||||
{
|
{
|
||||||
if (request.fHelp) {
|
if (request.fHelp) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct COrphanTx {
|
||||||
int64_t nTimeExpire;
|
int64_t nTimeExpire;
|
||||||
};
|
};
|
||||||
extern std::map<uint256, COrphanTx> mapOrphanTransactions;
|
extern std::map<uint256, COrphanTx> mapOrphanTransactions;
|
||||||
|
extern std::map<std::string, std::string> mapArgs;
|
||||||
|
|
||||||
CService ip(uint32_t i)
|
CService ip(uint32_t i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
std::unique_ptr<CConnman> g_connman;
|
std::unique_ptr<CConnman> g_connman;
|
||||||
FastRandomContext insecure_rand_ctx(true);
|
FastRandomContext insecure_rand_ctx(true);
|
||||||
|
|
||||||
|
extern std::map<std::string, std::string> mapArgs;
|
||||||
|
|
||||||
extern bool fPrintToConsole;
|
extern bool fPrintToConsole;
|
||||||
extern void noui_connect();
|
extern void noui_connect();
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
extern map<string, string> mapArgs;
|
||||||
|
|
||||||
BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup)
|
BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup)
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(util_criticalsection)
|
BOOST_AUTO_TEST_CASE(util_criticalsection)
|
||||||
|
|
|
@ -504,7 +504,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific)
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
if (IsArgSet("-datadir")) {
|
if (IsArgSet("-datadir")) {
|
||||||
path = fs::system_complete(mapArgs["-datadir"]);
|
path = fs::system_complete(GetArg("-datadir", ""));
|
||||||
if (!fs::is_directory(path)) {
|
if (!fs::is_directory(path)) {
|
||||||
path = "";
|
path = "";
|
||||||
return path;
|
return path;
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
boost::signals2::signal<std::string (const char* psz)> Translate;
|
boost::signals2::signal<std::string (const char* psz)> Translate;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::map<std::string, std::string> mapArgs;
|
|
||||||
extern const std::map<std::string, std::vector<std::string> >& mapMultiArgs;
|
extern const std::map<std::string, std::vector<std::string> >& mapMultiArgs;
|
||||||
extern bool fDebug;
|
extern bool fDebug;
|
||||||
extern bool fPrintToConsole;
|
extern bool fPrintToConsole;
|
||||||
|
|
|
@ -3621,8 +3621,8 @@ bool CWallet::ParameterInteraction()
|
||||||
if (IsArgSet("-mintxfee"))
|
if (IsArgSet("-mintxfee"))
|
||||||
{
|
{
|
||||||
CAmount n = 0;
|
CAmount n = 0;
|
||||||
if (!ParseMoney(mapArgs["-mintxfee"], n) || 0 == n)
|
if (!ParseMoney(GetArg("-mintxfee", ""), n) || 0 == n)
|
||||||
return InitError(AmountErrMsg("mintxfee", mapArgs["-mintxfee"]));
|
return InitError(AmountErrMsg("mintxfee", GetArg("-mintxfee", "")));
|
||||||
if (n > HIGH_TX_FEE_PER_KB)
|
if (n > HIGH_TX_FEE_PER_KB)
|
||||||
InitWarning(AmountHighWarn("-mintxfee") + " " +
|
InitWarning(AmountHighWarn("-mintxfee") + " " +
|
||||||
_("This is the minimum transaction fee you pay on every transaction."));
|
_("This is the minimum transaction fee you pay on every transaction."));
|
||||||
|
@ -3631,8 +3631,8 @@ bool CWallet::ParameterInteraction()
|
||||||
if (IsArgSet("-fallbackfee"))
|
if (IsArgSet("-fallbackfee"))
|
||||||
{
|
{
|
||||||
CAmount nFeePerK = 0;
|
CAmount nFeePerK = 0;
|
||||||
if (!ParseMoney(mapArgs["-fallbackfee"], nFeePerK))
|
if (!ParseMoney(GetArg("-fallbackfee", ""), nFeePerK))
|
||||||
return InitError(strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), mapArgs["-fallbackfee"]));
|
return InitError(strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), GetArg("-fallbackfee", "")));
|
||||||
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||||
InitWarning(AmountHighWarn("-fallbackfee") + " " +
|
InitWarning(AmountHighWarn("-fallbackfee") + " " +
|
||||||
_("This is the transaction fee you may pay when fee estimates are not available."));
|
_("This is the transaction fee you may pay when fee estimates are not available."));
|
||||||
|
@ -3641,8 +3641,8 @@ bool CWallet::ParameterInteraction()
|
||||||
if (IsArgSet("-paytxfee"))
|
if (IsArgSet("-paytxfee"))
|
||||||
{
|
{
|
||||||
CAmount nFeePerK = 0;
|
CAmount nFeePerK = 0;
|
||||||
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
|
if (!ParseMoney(GetArg("-paytxfee", ""), nFeePerK))
|
||||||
return InitError(AmountErrMsg("paytxfee", mapArgs["-paytxfee"]));
|
return InitError(AmountErrMsg("paytxfee", GetArg("-paytxfee", "")));
|
||||||
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||||
InitWarning(AmountHighWarn("-paytxfee") + " " +
|
InitWarning(AmountHighWarn("-paytxfee") + " " +
|
||||||
_("This is the transaction fee you will pay if you send a transaction."));
|
_("This is the transaction fee you will pay if you send a transaction."));
|
||||||
|
@ -3651,21 +3651,21 @@ bool CWallet::ParameterInteraction()
|
||||||
if (payTxFee < ::minRelayTxFee)
|
if (payTxFee < ::minRelayTxFee)
|
||||||
{
|
{
|
||||||
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
|
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
|
||||||
mapArgs["-paytxfee"], ::minRelayTxFee.ToString()));
|
GetArg("-paytxfee", ""), ::minRelayTxFee.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsArgSet("-maxtxfee"))
|
if (IsArgSet("-maxtxfee"))
|
||||||
{
|
{
|
||||||
CAmount nMaxFee = 0;
|
CAmount nMaxFee = 0;
|
||||||
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
|
if (!ParseMoney(GetArg("-maxtxfee", ""), nMaxFee))
|
||||||
return InitError(AmountErrMsg("maxtxfee", mapArgs["-maxtxfee"]));
|
return InitError(AmountErrMsg("maxtxfee", GetArg("-maxtxfee", "")));
|
||||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||||
maxTxFee = nMaxFee;
|
maxTxFee = nMaxFee;
|
||||||
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
|
||||||
{
|
{
|
||||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
|
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
|
||||||
mapArgs["-maxtxfee"], ::minRelayTxFee.ToString()));
|
GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
|
nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
|
||||||
|
|
Loading…
Reference in a new issue