Skip to content

Commit ea4cc3a

Browse files
committed
Truly decouple wallet from chainparams for -fallbackfee
Before it was 0 by default for main and 20000 for test and regtest. Now it is 0 by default for all chains, thus there's no need to call Params(). Also now the default for main is properly documented
1 parent 884f7cc commit ea4cc3a

File tree

5 files changed

+16
-5
lines changed

5 files changed

+16
-5
lines changed

doc/release-notes-16524.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
Low-level changes
3+
=================
4+
5+
Tests
6+
---
7+
8+
- `-fallbackfee` was 0 (disabled) by default for the main chain, but 20000 by default for the test chains. Now it is 0 by default for all chains. Testnet and regtest users will have to add fallbackfee=20000 to their configuration if they weren't setting it and they want it to keep working like before. (#16524)

src/wallet/init.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ void WalletInit::AddWalletOptions() const
4141
gArgs.AddArg("-discardfee=<amt>", strprintf("The fee rate (in %s/kB) that indicates your tolerance for discarding change by adding it to the fee (default: %s). "
4242
"Note: An output is discarded if it is dust at this rate, but we will always discard up to the dust relay fee and a discard fee above that is limited by the fee estimate for the longest target",
4343
CURRENCY_UNIT, FormatMoney(DEFAULT_DISCARD_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
44-
gArgs.AddArg("-fallbackfee=<amt>", strprintf("A fee rate (in %s/kB) that will be used when fee estimation has insufficient data (default: %s)",
44+
45+
gArgs.AddArg("-fallbackfee=<amt>", strprintf("A fee rate (in %s/kB) that will be used when fee estimation has insufficient data. 0 to entirely disable the fallbackfee feature. (default: %s)",
4546
CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
4647
gArgs.AddArg("-keypool=<n>", strprintf("Set key pool size to <n> (default: %u)", DEFAULT_KEYPOOL_SIZE), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
4748
gArgs.AddArg("-maxtxfee=<amt>", strprintf("Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)",

src/wallet/wallet.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4420,7 +4420,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
44204420
walletInstance->m_min_fee = CFeeRate(n);
44214421
}
44224422

4423-
walletInstance->m_allow_fallback_fee = Params().IsTestChain();
44244423
if (gArgs.IsArgSet("-fallbackfee")) {
44254424
CAmount nFeePerK = 0;
44264425
if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) {
@@ -4432,8 +4431,10 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
44324431
_("This is the transaction fee you may pay when fee estimates are not available.").translated);
44334432
}
44344433
walletInstance->m_fallback_fee = CFeeRate(nFeePerK);
4435-
walletInstance->m_allow_fallback_fee = nFeePerK != 0; //disable fallback fee in case value was set to 0, enable if non-null value
44364434
}
4435+
// Disable fallback fee in case value was set to 0, enable if non-null value
4436+
walletInstance->m_allow_fallback_fee = walletInstance->m_fallback_fee.GetFeePerK() != 0;
4437+
44374438
if (gArgs.IsArgSet("-discardfee")) {
44384439
CAmount nFeePerK = 0;
44394440
if (!ParseMoney(gArgs.GetArg("-discardfee", ""), nFeePerK)) {

src/wallet/wallet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
6363
//! -paytxfee default
6464
constexpr CAmount DEFAULT_PAY_TX_FEE = 0;
6565
//! -fallbackfee default
66-
static const CAmount DEFAULT_FALLBACK_FEE = 20000;
66+
static const CAmount DEFAULT_FALLBACK_FEE = 0;
6767
//! -discardfee default
6868
static const CAmount DEFAULT_DISCARD_FEE = 10000;
6969
//! -mintxfee default
@@ -1167,7 +1167,7 @@ class CWallet final : public FillableSigningProvider, private interfaces::Chain:
11671167
unsigned int m_confirm_target{DEFAULT_TX_CONFIRM_TARGET};
11681168
bool m_spend_zero_conf_change{DEFAULT_SPEND_ZEROCONF_CHANGE};
11691169
bool m_signal_rbf{DEFAULT_WALLET_RBF};
1170-
bool m_allow_fallback_fee{true}; //!< will be defined via chainparams
1170+
bool m_allow_fallback_fee{true}; //!< will be false if -fallbackfee=0
11711171
CFeeRate m_min_fee{DEFAULT_TRANSACTION_MINFEE}; //!< Override with -mintxfee
11721172
/**
11731173
* If fee estimation does not have enough data to provide estimates, use this fee instead.

test/functional/test_framework/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def initialize_datadir(dirname, n, chain):
299299
f.write("[{}]\n".format(chain_name_conf_section))
300300
f.write("port=" + str(p2p_port(n)) + "\n")
301301
f.write("rpcport=" + str(rpc_port(n)) + "\n")
302+
f.write("fallbackfee=0.0002\n")
302303
f.write("server=1\n")
303304
f.write("keypool=1\n")
304305
f.write("discover=0\n")

0 commit comments

Comments
 (0)