aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Timón <jtimon@jtimon.cc>2019-08-01 22:39:46 +0200
committerJorge Timón <jtimon@jtimon.cc>2019-10-02 18:10:07 +0200
commitea4cc3a7b36a9c77dbf0aff439da3ef0ea58e6e4 (patch)
tree222e89e3f52b551ee3817989fd048236475728b8
parent884f7cc81b478b599ed8d43ebe80578ea9cdb279 (diff)
downloadbitcoin-ea4cc3a7b36a9c77dbf0aff439da3ef0ea58e6e4.tar.xz
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
-rw-r--r--doc/release-notes-16524.md8
-rw-r--r--src/wallet/init.cpp3
-rw-r--r--src/wallet/wallet.cpp5
-rw-r--r--src/wallet/wallet.h4
-rw-r--r--test/functional/test_framework/util.py1
5 files changed, 16 insertions, 5 deletions
diff --git a/doc/release-notes-16524.md b/doc/release-notes-16524.md
new file mode 100644
index 0000000000..11c2f60c38
--- /dev/null
+++ b/doc/release-notes-16524.md
@@ -0,0 +1,8 @@
+
+Low-level changes
+=================
+
+Tests
+---
+
+- `-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)
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp
index e766deadb7..43b6ead028 100644
--- a/src/wallet/init.cpp
+++ b/src/wallet/init.cpp
@@ -41,7 +41,8 @@ void WalletInit::AddWalletOptions() const
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). "
"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",
CURRENCY_UNIT, FormatMoney(DEFAULT_DISCARD_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
- gArgs.AddArg("-fallbackfee=<amt>", strprintf("A fee rate (in %s/kB) that will be used when fee estimation has insufficient data (default: %s)",
+
+ 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)",
CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE)), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
gArgs.AddArg("-keypool=<n>", strprintf("Set key pool size to <n> (default: %u)", DEFAULT_KEYPOOL_SIZE), ArgsManager::ALLOW_ANY, OptionsCategory::WALLET);
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)",
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 7cf09d554b..c131250d9f 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -4420,7 +4420,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
walletInstance->m_min_fee = CFeeRate(n);
}
- walletInstance->m_allow_fallback_fee = Params().IsTestChain();
if (gArgs.IsArgSet("-fallbackfee")) {
CAmount nFeePerK = 0;
if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) {
@@ -4432,8 +4431,10 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
_("This is the transaction fee you may pay when fee estimates are not available.").translated);
}
walletInstance->m_fallback_fee = CFeeRate(nFeePerK);
- walletInstance->m_allow_fallback_fee = nFeePerK != 0; //disable fallback fee in case value was set to 0, enable if non-null value
}
+ // Disable fallback fee in case value was set to 0, enable if non-null value
+ walletInstance->m_allow_fallback_fee = walletInstance->m_fallback_fee.GetFeePerK() != 0;
+
if (gArgs.IsArgSet("-discardfee")) {
CAmount nFeePerK = 0;
if (!ParseMoney(gArgs.GetArg("-discardfee", ""), nFeePerK)) {
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 3428e8e001..7d14e2ab80 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -63,7 +63,7 @@ static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
//! -paytxfee default
constexpr CAmount DEFAULT_PAY_TX_FEE = 0;
//! -fallbackfee default
-static const CAmount DEFAULT_FALLBACK_FEE = 20000;
+static const CAmount DEFAULT_FALLBACK_FEE = 0;
//! -discardfee default
static const CAmount DEFAULT_DISCARD_FEE = 10000;
//! -mintxfee default
@@ -1167,7 +1167,7 @@ public:
unsigned int m_confirm_target{DEFAULT_TX_CONFIRM_TARGET};
bool m_spend_zero_conf_change{DEFAULT_SPEND_ZEROCONF_CHANGE};
bool m_signal_rbf{DEFAULT_WALLET_RBF};
- bool m_allow_fallback_fee{true}; //!< will be defined via chainparams
+ bool m_allow_fallback_fee{true}; //!< will be false if -fallbackfee=0
CFeeRate m_min_fee{DEFAULT_TRANSACTION_MINFEE}; //!< Override with -mintxfee
/**
* If fee estimation does not have enough data to provide estimates, use this fee instead.
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index f9f5fe553e..ebd7e5d51a 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -299,6 +299,7 @@ def initialize_datadir(dirname, n, chain):
f.write("[{}]\n".format(chain_name_conf_section))
f.write("port=" + str(p2p_port(n)) + "\n")
f.write("rpcport=" + str(rpc_port(n)) + "\n")
+ f.write("fallbackfee=0.0002\n")
f.write("server=1\n")
f.write("keypool=1\n")
f.write("discover=0\n")