51
src/init.cpp
51
src/init.cpp
@@ -946,55 +946,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
nBytesPerSigOp = GetArg("-bytespersigop", nBytesPerSigOp);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
if (mapArgs.count("-mintxfee"))
|
||||
{
|
||||
CAmount n = 0;
|
||||
if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0)
|
||||
CWallet::minTxFee = CFeeRate(n);
|
||||
else
|
||||
return InitError(strprintf(_("Invalid amount for -mintxfee=<amount>: '%s'"), mapArgs["-mintxfee"]));
|
||||
}
|
||||
if (mapArgs.count("-fallbackfee"))
|
||||
{
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(mapArgs["-fallbackfee"], nFeePerK))
|
||||
return InitError(strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), mapArgs["-fallbackfee"]));
|
||||
if (nFeePerK > nHighTransactionFeeWarning)
|
||||
InitWarning(_("-fallbackfee is set very high! This is the transaction fee you may pay when fee estimates are not available."));
|
||||
CWallet::fallbackFee = CFeeRate(nFeePerK);
|
||||
}
|
||||
if (mapArgs.count("-paytxfee"))
|
||||
{
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
|
||||
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s'"), mapArgs["-paytxfee"]));
|
||||
if (nFeePerK > nHighTransactionFeeWarning)
|
||||
InitWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
|
||||
payTxFee = CFeeRate(nFeePerK, 1000);
|
||||
if (payTxFee < ::minRelayTxFee)
|
||||
{
|
||||
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
|
||||
mapArgs["-paytxfee"], ::minRelayTxFee.ToString()));
|
||||
}
|
||||
}
|
||||
if (mapArgs.count("-maxtxfee"))
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
|
||||
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s'"), mapArgs["-maxtxfee"]));
|
||||
if (nMaxFee > nHighTransactionMaxFeeWarning)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
maxTxFee = nMaxFee;
|
||||
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)"),
|
||||
mapArgs["-maxtxfee"], ::minRelayTxFee.ToString()));
|
||||
}
|
||||
}
|
||||
nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
|
||||
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
|
||||
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", DEFAULT_SEND_FREE_TRANSACTIONS);
|
||||
|
||||
if (!CWallet::ParameterInteraction())
|
||||
return false;
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
|
||||
|
||||
@@ -16,8 +16,6 @@ namespace boost
|
||||
class thread_group;
|
||||
} // namespace boost
|
||||
|
||||
extern CWallet* pwalletMain;
|
||||
|
||||
void StartShutdown();
|
||||
bool ShutdownRequested();
|
||||
/** Interrupt threads */
|
||||
|
||||
@@ -53,6 +53,10 @@ static const bool DEFAULT_WHITELISTRELAY = true;
|
||||
static const bool DEFAULT_WHITELISTFORCERELAY = true;
|
||||
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
||||
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 10000;
|
||||
//! Discourage users to set fees higher than this amount (in satoshis) per kB
|
||||
static const CAmount HIGH_TX_FEE_PER_KB = 0.1 * COIN;
|
||||
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
|
||||
static const CAmount HIGH_MAX_TX_FEE = 100 * HIGH_TX_FEE_PER_KB;
|
||||
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
|
||||
static const unsigned int DEFAULT_MAX_ORPHAN_TRANSACTIONS = 100;
|
||||
/** Default for -limitancestorcount, max number of in-mempool ancestors */
|
||||
|
||||
@@ -3697,6 +3697,60 @@ bool CWallet::InitLoadWallet()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CWallet::ParameterInteraction()
|
||||
{
|
||||
if (mapArgs.count("-mintxfee"))
|
||||
{
|
||||
CAmount n = 0;
|
||||
if (ParseMoney(mapArgs["-mintxfee"], n) && n > 0)
|
||||
CWallet::minTxFee = CFeeRate(n);
|
||||
else
|
||||
return InitError(AmountErrMsg("mintxfee", mapArgs["-mintxfee"]));
|
||||
}
|
||||
if (mapArgs.count("-fallbackfee"))
|
||||
{
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(mapArgs["-fallbackfee"], nFeePerK))
|
||||
return InitError(strprintf(_("Invalid amount for -fallbackfee=<amount>: '%s'"), mapArgs["-fallbackfee"]));
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||
InitWarning(_("-fallbackfee is set very high! This is the transaction fee you may pay when fee estimates are not available."));
|
||||
CWallet::fallbackFee = CFeeRate(nFeePerK);
|
||||
}
|
||||
if (mapArgs.count("-paytxfee"))
|
||||
{
|
||||
CAmount nFeePerK = 0;
|
||||
if (!ParseMoney(mapArgs["-paytxfee"], nFeePerK))
|
||||
return InitError(AmountErrMsg("paytxfee", mapArgs["-paytxfee"]));
|
||||
if (nFeePerK > HIGH_TX_FEE_PER_KB)
|
||||
InitWarning(_("-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction."));
|
||||
payTxFee = CFeeRate(nFeePerK, 1000);
|
||||
if (payTxFee < ::minRelayTxFee)
|
||||
{
|
||||
return InitError(strprintf(_("Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
|
||||
mapArgs["-paytxfee"], ::minRelayTxFee.ToString()));
|
||||
}
|
||||
}
|
||||
if (mapArgs.count("-maxtxfee"))
|
||||
{
|
||||
CAmount nMaxFee = 0;
|
||||
if (!ParseMoney(mapArgs["-maxtxfee"], nMaxFee))
|
||||
return InitError(AmountErrMsg("maxtxfee", mapArgs["-maxtxfee"]));
|
||||
if (nMaxFee > HIGH_MAX_TX_FEE)
|
||||
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
|
||||
maxTxFee = nMaxFee;
|
||||
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)"),
|
||||
mapArgs["-maxtxfee"], ::minRelayTxFee.ToString()));
|
||||
}
|
||||
}
|
||||
nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
|
||||
bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
|
||||
fSendFreeTransactions = GetBoolArg("-sendfreetransactions", DEFAULT_SEND_FREE_TRANSACTIONS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CKeyPool::CKeyPool()
|
||||
{
|
||||
nTime = GetTime();
|
||||
|
||||
@@ -829,6 +829,9 @@ public:
|
||||
/* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */
|
||||
static bool InitLoadWallet();
|
||||
|
||||
/* Wallets parameter interaction */
|
||||
static bool ParameterInteraction();
|
||||
|
||||
/* Set the HD chain model (chain child index counters) */
|
||||
bool SetHDChain(const CHDChain& chain, bool memonly);
|
||||
const CHDChain& GetHDChain() { return hdChain; }
|
||||
|
||||
Reference in New Issue
Block a user