Skip to content

Commit a689c11

Browse files
author
MarcoFalke
committed
Merge #16524: Wallet: Disable -fallbackfee by default
ea4cc3a Truly decouple wallet from chainparams for -fallbackfee (Jorge Timón) Pull request description: 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. Suggestion for release notes: -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. Should I propose them to the wiki for the release notes or only after merge? For more context, see bitcoin/bitcoin#16402 (comment) ACKs for top commit: MarcoFalke: ACK ea4cc3a Tree-SHA512: fdfaba5d813da4221e405e0988bef44f3856d10f897a94f9614386d14b7716f4326ab8a6646e26d41ef3f4fa61b936191e216b1b605e9ab0520b0657fc162e6c
2 parents f4a0d27 + ea4cc3a commit a689c11

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
@@ -4421,7 +4421,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
44214421
walletInstance->m_min_fee = CFeeRate(n);
44224422
}
44234423

4424-
walletInstance->m_allow_fallback_fee = Params().IsTestChain();
44254424
if (gArgs.IsArgSet("-fallbackfee")) {
44264425
CAmount nFeePerK = 0;
44274426
if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) {
@@ -4433,8 +4432,10 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
44334432
_("This is the transaction fee you may pay when fee estimates are not available.").translated);
44344433
}
44354434
walletInstance->m_fallback_fee = CFeeRate(nFeePerK);
4436-
walletInstance->m_allow_fallback_fee = nFeePerK != 0; //disable fallback fee in case value was set to 0, enable if non-null value
44374435
}
4436+
// Disable fallback fee in case value was set to 0, enable if non-null value
4437+
walletInstance->m_allow_fallback_fee = walletInstance->m_fallback_fee.GetFeePerK() != 0;
4438+
44384439
if (gArgs.IsArgSet("-discardfee")) {
44394440
CAmount nFeePerK = 0;
44404441
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
@@ -307,6 +307,7 @@ def initialize_datadir(dirname, n, chain):
307307
f.write("[{}]\n".format(chain_name_conf_section))
308308
f.write("port=" + str(p2p_port(n)) + "\n")
309309
f.write("rpcport=" + str(rpc_port(n)) + "\n")
310+
f.write("fallbackfee=0.0002\n")
310311
f.write("server=1\n")
311312
f.write("keypool=1\n")
312313
f.write("discover=0\n")

0 commit comments

Comments
 (0)