mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
Merge bitcoin/bitcoin#25254: Move minRelayTxFee to policy/settings
fa4068b4e2
Move minRelayTxFee to policy/settings (MacroFake) Pull request description: Seems a bit confusing to put policy stuff into validation, so fix that. Also fix includes via `iwyu`. ACKs for top commit: ariard: ACKfa4068b
, the includes move compiles well locally. ryanofsky: Code review ACKfa4068b4e2
. Make sense to move the global variable to policy/settings and the default constant to policy/policy. Ariard points out other constants that could be moved, which seems fine, but it seems like moving the global variable to be with other related global variables is more significant. Tree-SHA512: adf9619002610d1877f3aef0a9e6115fc4c2ad64135a3e5100824c650b560c47f47ac28894c6214a50a7888355252a9f6f7cec98c23a771a1964160ef1ca77de
This commit is contained in:
commit
2ab4a80480
19 changed files with 83 additions and 19 deletions
|
@ -41,6 +41,9 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
||||||
CI_EXEC "python3 ${DIR_IWYU}/include-what-you-use/iwyu_tool.py"\
|
CI_EXEC "python3 ${DIR_IWYU}/include-what-you-use/iwyu_tool.py"\
|
||||||
" src/compat"\
|
" src/compat"\
|
||||||
" src/init"\
|
" src/init"\
|
||||||
|
" src/policy/feerate.cpp"\
|
||||||
|
" src/policy/packages.cpp"\
|
||||||
|
" src/policy/settings.cpp"\
|
||||||
" src/rpc/fees.cpp"\
|
" src/rpc/fees.cpp"\
|
||||||
" src/rpc/signmessage.cpp"\
|
" src/rpc/signmessage.cpp"\
|
||||||
" -p . ${MAKEJOBS} -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp"
|
" -p . ${MAKEJOBS} -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <node/blockstorage.h>
|
#include <node/blockstorage.h>
|
||||||
#include <policy/fees.h>
|
#include <policy/fees.h>
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
|
#include <policy/settings.h>
|
||||||
#include <primitives/block.h>
|
#include <primitives/block.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <consensus/amount.h>
|
||||||
#include <policy/feerate.h>
|
#include <policy/feerate.h>
|
||||||
|
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -9,7 +9,10 @@
|
||||||
#include <consensus/amount.h>
|
#include <consensus/amount.h>
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
const std::string CURRENCY_UNIT = "BTC"; // One formatted unit
|
const std::string CURRENCY_UNIT = "BTC"; // One formatted unit
|
||||||
const std::string CURRENCY_ATOM = "sat"; // One indivisible minimum value unit
|
const std::string CURRENCY_ATOM = "sat"; // One indivisible minimum value unit
|
||||||
|
|
|
@ -6,12 +6,30 @@
|
||||||
#include <policy/fees.h>
|
#include <policy/fees.h>
|
||||||
|
|
||||||
#include <clientversion.h>
|
#include <clientversion.h>
|
||||||
|
#include <consensus/amount.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
|
#include <policy/feerate.h>
|
||||||
|
#include <primitives/transaction.h>
|
||||||
|
#include <random.h>
|
||||||
|
#include <serialize.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
|
#include <sync.h>
|
||||||
|
#include <tinyformat.h>
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
|
#include <uint256.h>
|
||||||
#include <util/serfloat.h>
|
#include <util/serfloat.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
|
#include <util/time.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <exception>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
static const char* FEE_ESTIMATES_FILENAME = "fee_estimates.dat";
|
static const char* FEE_ESTIMATES_FILENAME = "fee_estimates.dat";
|
||||||
|
|
||||||
|
|
|
@ -7,20 +7,20 @@
|
||||||
|
|
||||||
#include <consensus/amount.h>
|
#include <consensus/amount.h>
|
||||||
#include <policy/feerate.h>
|
#include <policy/feerate.h>
|
||||||
#include <uint256.h>
|
|
||||||
#include <random.h>
|
#include <random.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
|
#include <threadsafety.h>
|
||||||
|
#include <uint256.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CAutoFile;
|
class CAutoFile;
|
||||||
class CFeeRate;
|
|
||||||
class CTxMemPoolEntry;
|
class CTxMemPoolEntry;
|
||||||
class CTxMemPool;
|
|
||||||
class TxConfirmStats;
|
class TxConfirmStats;
|
||||||
|
|
||||||
/* Identifier for each of the 3 different TxConfirmStats which will track
|
/* Identifier for each of the 3 different TxConfirmStats which will track
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <consensus/validation.h>
|
|
||||||
#include <policy/packages.h>
|
#include <policy/packages.h>
|
||||||
|
#include <policy/policy.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
#include <util/hasher.h>
|
#include <util/hasher.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
|
#include <memory>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
#ifndef BITCOIN_POLICY_PACKAGES_H
|
#ifndef BITCOIN_POLICY_PACKAGES_H
|
||||||
#define BITCOIN_POLICY_PACKAGES_H
|
#define BITCOIN_POLICY_PACKAGES_H
|
||||||
|
|
||||||
|
#include <consensus/consensus.h>
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/** Default maximum number of transactions in a package. */
|
/** Default maximum number of transactions in a package. */
|
||||||
|
|
|
@ -7,10 +7,22 @@
|
||||||
|
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
|
|
||||||
#include <consensus/validation.h>
|
|
||||||
#include <coins.h>
|
#include <coins.h>
|
||||||
|
#include <consensus/amount.h>
|
||||||
|
#include <consensus/consensus.h>
|
||||||
|
#include <consensus/validation.h>
|
||||||
|
#include <policy/feerate.h>
|
||||||
|
#include <primitives/transaction.h>
|
||||||
|
#include <script/interpreter.h>
|
||||||
|
#include <script/script.h>
|
||||||
|
#include <script/standard.h>
|
||||||
|
#include <serialize.h>
|
||||||
#include <span.h>
|
#include <span.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
|
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
|
||||||
{
|
{
|
||||||
// "Dust" is defined in terms of dustRelayFee,
|
// "Dust" is defined in terms of dustRelayFee,
|
||||||
|
|
|
@ -6,15 +6,18 @@
|
||||||
#ifndef BITCOIN_POLICY_POLICY_H
|
#ifndef BITCOIN_POLICY_POLICY_H
|
||||||
#define BITCOIN_POLICY_POLICY_H
|
#define BITCOIN_POLICY_POLICY_H
|
||||||
|
|
||||||
|
#include <consensus/amount.h>
|
||||||
#include <consensus/consensus.h>
|
#include <consensus/consensus.h>
|
||||||
#include <policy/feerate.h>
|
#include <primitives/transaction.h>
|
||||||
#include <script/interpreter.h>
|
#include <script/interpreter.h>
|
||||||
#include <script/standard.h>
|
#include <script/standard.h>
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class CCoinsViewCache;
|
class CCoinsViewCache;
|
||||||
class CTxOut;
|
class CFeeRate;
|
||||||
|
class CScript;
|
||||||
|
|
||||||
/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/
|
/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/
|
||||||
static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000;
|
static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000;
|
||||||
|
@ -52,6 +55,8 @@ static const unsigned int MAX_STANDARD_SCRIPTSIG_SIZE = 1650;
|
||||||
* only increase the dust limit after prior releases were already not creating
|
* only increase the dust limit after prior releases were already not creating
|
||||||
* outputs below the new threshold */
|
* outputs below the new threshold */
|
||||||
static const unsigned int DUST_RELAY_TX_FEE = 3000;
|
static const unsigned int DUST_RELAY_TX_FEE = 3000;
|
||||||
|
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
||||||
|
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
|
||||||
/**
|
/**
|
||||||
* Standard script verification flags that standard transactions will comply
|
* Standard script verification flags that standard transactions will comply
|
||||||
* with. However scripts violating these flags may still be present in valid
|
* with. However scripts violating these flags may still be present in valid
|
||||||
|
|
|
@ -4,11 +4,19 @@
|
||||||
|
|
||||||
#include <policy/rbf.h>
|
#include <policy/rbf.h>
|
||||||
|
|
||||||
#include <policy/settings.h>
|
#include <consensus/amount.h>
|
||||||
|
#include <policy/feerate.h>
|
||||||
|
#include <primitives/transaction.h>
|
||||||
|
#include <sync.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
|
#include <txmempool.h>
|
||||||
|
#include <uint256.h>
|
||||||
#include <util/moneystr.h>
|
#include <util/moneystr.h>
|
||||||
#include <util/rbf.h>
|
#include <util/rbf.h>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
|
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool)
|
||||||
{
|
{
|
||||||
AssertLockHeld(pool.cs);
|
AssertLockHeld(pool.cs);
|
||||||
|
|
|
@ -5,13 +5,20 @@
|
||||||
#ifndef BITCOIN_POLICY_RBF_H
|
#ifndef BITCOIN_POLICY_RBF_H
|
||||||
#define BITCOIN_POLICY_RBF_H
|
#define BITCOIN_POLICY_RBF_H
|
||||||
|
|
||||||
|
#include <consensus/amount.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
|
#include <threadsafety.h>
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <uint256.h>
|
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
class CFeeRate;
|
||||||
|
class uint256;
|
||||||
|
|
||||||
/** Maximum number of transactions that can be replaced by BIP125 RBF (Rule #5). This includes all
|
/** Maximum number of transactions that can be replaced by BIP125 RBF (Rule #5). This includes all
|
||||||
* mempool conflicts and their descendants. */
|
* mempool conflicts and their descendants. */
|
||||||
static constexpr uint32_t MAX_BIP125_REPLACEMENT_CANDIDATES{100};
|
static constexpr uint32_t MAX_BIP125_REPLACEMENT_CANDIDATES{100};
|
||||||
|
|
|
@ -11,4 +11,5 @@
|
||||||
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
|
bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
|
||||||
CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE);
|
CFeeRate incrementalRelayFee = CFeeRate(DEFAULT_INCREMENTAL_RELAY_FEE);
|
||||||
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE);
|
CFeeRate dustRelayFee = CFeeRate(DUST_RELAY_TX_FEE);
|
||||||
|
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
||||||
unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP;
|
unsigned int nBytesPerSigOp = DEFAULT_BYTES_PER_SIGOP;
|
||||||
|
|
|
@ -6,14 +6,19 @@
|
||||||
#ifndef BITCOIN_POLICY_SETTINGS_H
|
#ifndef BITCOIN_POLICY_SETTINGS_H
|
||||||
#define BITCOIN_POLICY_SETTINGS_H
|
#define BITCOIN_POLICY_SETTINGS_H
|
||||||
|
|
||||||
|
#include <policy/feerate.h>
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
|
|
||||||
class CFeeRate;
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class CTransaction;
|
class CTransaction;
|
||||||
|
|
||||||
// Policy settings which are configurable at runtime.
|
// Policy settings which are configurable at runtime.
|
||||||
extern CFeeRate incrementalRelayFee;
|
extern CFeeRate incrementalRelayFee;
|
||||||
extern CFeeRate dustRelayFee;
|
extern CFeeRate dustRelayFee;
|
||||||
|
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
|
||||||
|
extern CFeeRate minRelayTxFee;
|
||||||
extern unsigned int nBytesPerSigOp;
|
extern unsigned int nBytesPerSigOp;
|
||||||
extern bool fIsBareMultisigStd;
|
extern bool fIsBareMultisigStd;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <policy/feerate.h>
|
#include <policy/feerate.h>
|
||||||
#include <policy/fees.h>
|
#include <policy/fees.h>
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
|
#include <policy/settings.h>
|
||||||
#include <rpc/protocol.h>
|
#include <rpc/protocol.h>
|
||||||
#include <rpc/request.h>
|
#include <rpc/request.h>
|
||||||
#include <rpc/server.h>
|
#include <rpc/server.h>
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
#include <util/fees.h>
|
#include <util/fees.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <validation.h>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <core_io.h>
|
#include <core_io.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <policy/rbf.h>
|
#include <policy/rbf.h>
|
||||||
|
#include <policy/settings.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <rpc/server.h>
|
#include <rpc/server.h>
|
||||||
#include <rpc/server_util.h>
|
#include <rpc/server_util.h>
|
||||||
|
@ -15,7 +16,6 @@
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
#include <util/moneystr.h>
|
#include <util/moneystr.h>
|
||||||
#include <validation.h>
|
|
||||||
|
|
||||||
using node::DEFAULT_MAX_RAW_TX_FEE_RATE;
|
using node::DEFAULT_MAX_RAW_TX_FEE_RATE;
|
||||||
using node::NodeContext;
|
using node::NodeContext;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <consensus/validation.h>
|
#include <consensus/validation.h>
|
||||||
#include <core_memusage.h>
|
#include <core_memusage.h>
|
||||||
|
#include <policy/feerate.h>
|
||||||
#include <policy/policy.h>
|
#include <policy/policy.h>
|
||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
|
|
|
@ -134,8 +134,6 @@ int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
|
||||||
uint256 hashAssumeValid;
|
uint256 hashAssumeValid;
|
||||||
arith_uint256 nMinimumChainWork;
|
arith_uint256 nMinimumChainWork;
|
||||||
|
|
||||||
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
|
|
||||||
|
|
||||||
const CBlockIndex* CChainState::FindForkInGlobalIndex(const CBlockLocator& locator) const
|
const CBlockIndex* CChainState::FindForkInGlobalIndex(const CBlockLocator& locator) const
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
|
@ -58,8 +58,6 @@ namespace Consensus {
|
||||||
struct Params;
|
struct Params;
|
||||||
} // namespace Consensus
|
} // namespace Consensus
|
||||||
|
|
||||||
/** Default for -minrelaytxfee, minimum relay fee for transactions */
|
|
||||||
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
|
|
||||||
/** Default for -limitancestorcount, max number of in-mempool ancestors */
|
/** Default for -limitancestorcount, max number of in-mempool ancestors */
|
||||||
static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25;
|
static const unsigned int DEFAULT_ANCESTOR_LIMIT = 25;
|
||||||
/** Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors */
|
/** Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors */
|
||||||
|
@ -126,8 +124,6 @@ extern bool g_parallel_script_checks;
|
||||||
extern bool fRequireStandard;
|
extern bool fRequireStandard;
|
||||||
extern bool fCheckBlockIndex;
|
extern bool fCheckBlockIndex;
|
||||||
extern bool fCheckpointsEnabled;
|
extern bool fCheckpointsEnabled;
|
||||||
/** A fee rate smaller than this is considered zero fee (for relaying, mining and transaction creation) */
|
|
||||||
extern CFeeRate minRelayTxFee;
|
|
||||||
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
|
/** If the tip is older than this (in seconds), the node is considered to be in initial block download. */
|
||||||
extern int64_t nMaxTipAge;
|
extern int64_t nMaxTipAge;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue