diff --git a/src/miner.cpp b/src/miner.cpp --- a/src/miner.cpp +++ b/src/miner.cpp @@ -102,13 +102,8 @@ BlockAssembler::BlockAssembler(const Config &_config, const CChainParams &_chainparams) : chainparams(_chainparams), config(&_config) { - if (IsArgSet("-blockmintxfee")) { - CAmount n = 0; - ParseMoney(GetArg("-blockmintxfee", ""), n); - blockMinFeeRate = CFeeRate(n); - } else { - blockMinFeeRate = CFeeRate(DEFAULT_BLOCK_MIN_TX_FEE); - } + blockMinFeeRate = + CFeeRate(GetArg("-blockmintxfee", DEFAULT_BLOCK_MIN_TX_FEE)); LOCK(cs_main); nMaxGeneratedBlockSize = diff --git a/src/policy/policy.h b/src/policy/policy.h --- a/src/policy/policy.h +++ b/src/policy/policy.h @@ -22,7 +22,7 @@ static const uint64_t DEFAULT_BLOCK_PRIORITY_PERCENTAGE = 5; /** Default for -blockmintxfee, which sets the minimum feerate for a transaction * in blocks created by mining code **/ -static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 1000; +static const unsigned int DEFAULT_BLOCK_MIN_TX_FEE = 0; /** The maximum size for transactions we're willing to relay/mine */ static const unsigned int MAX_STANDARD_TX_SIZE = 100000; /** Maximum number of signature check operations in an IsStandard() P2SH script diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -2,13 +2,13 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#include "miner.h" #include "chainparams.h" #include "coins.h" #include "config.h" #include "consensus/consensus.h" #include "consensus/merkle.h" #include "consensus/validation.h" -#include "miner.h" #include "policy/policy.h" #include "pubkey.h" #include "script/standard.h" @@ -88,6 +88,10 @@ // these 3 tests assume blockprioritypercentage is 0. config.SetBlockPriorityPercentage(0); + // the following tests assume that minimum fee rate is 1000 satoshi per kB. + ForceSetArg("-blockmintxfee", std::to_string(1000)); + blockMinFeeRate = CFeeRate(1000); + // Test that a medium fee transaction will be selected after a higher fee // rate package with a low fee rate parent. CMutableTransaction tx; diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -58,7 +58,7 @@ /** Default for DEFAULT_WHITELISTFORCERELAY. */ static const bool DEFAULT_WHITELISTFORCERELAY = true; /** Default for -minrelaytxfee, minimum relay fee for transactions */ -static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000; +static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 0; //! -maxtxfee default static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN.GetSatoshis(); //! Discourage users to set fees higher than this amount (in satoshis) per kB @@ -142,7 +142,7 @@ */ static const int64_t BLOCK_DOWNLOAD_TIMEOUT_PER_PEER = 500000; -static const unsigned int DEFAULT_LIMITFREERELAY = 0; +static const unsigned int DEFAULT_LIMITFREERELAY = 20; static const bool DEFAULT_RELAYPRIORITY = true; static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60; /** Maximum age of our tip in seconds for us to be considered current for fee