Skip to content

Commit 2ab4a80

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25254: Move minRelayTxFee to policy/settings
fa4068b 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: ACK fa4068b, the includes move compiles well locally. ryanofsky: Code review ACK fa4068b. 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
2 parents f66633d + fa4068b commit 2ab4a80

19 files changed

+83
-19
lines changed

ci/test/06_script_b.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ if [ "${RUN_TIDY}" = "true" ]; then
4141
CI_EXEC "python3 ${DIR_IWYU}/include-what-you-use/iwyu_tool.py"\
4242
" src/compat"\
4343
" src/init"\
44+
" src/policy/feerate.cpp"\
45+
" src/policy/packages.cpp"\
46+
" src/policy/settings.cpp"\
4447
" src/rpc/fees.cpp"\
4548
" src/rpc/signmessage.cpp"\
4649
" -p . ${MAKEJOBS} -- -Xiwyu --cxx17ns -Xiwyu --mapping_file=${BASE_BUILD_DIR}/bitcoin-$HOST/contrib/devtools/iwyu/bitcoin.core.imp"

src/net_processing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <node/blockstorage.h>
2222
#include <policy/fees.h>
2323
#include <policy/policy.h>
24+
#include <policy/settings.h>
2425
#include <primitives/block.h>
2526
#include <primitives/transaction.h>
2627
#include <random.h>

src/policy/feerate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6+
#include <consensus/amount.h>
67
#include <policy/feerate.h>
7-
88
#include <tinyformat.h>
99

1010
#include <cmath>

src/policy/feerate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
#include <consensus/amount.h>
1010
#include <serialize.h>
1111

12+
13+
#include <cstdint>
1214
#include <string>
15+
#include <type_traits>
1316

1417
const std::string CURRENCY_UNIT = "BTC"; // One formatted unit
1518
const std::string CURRENCY_ATOM = "sat"; // One indivisible minimum value unit

src/policy/fees.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,30 @@
66
#include <policy/fees.h>
77

88
#include <clientversion.h>
9+
#include <consensus/amount.h>
910
#include <fs.h>
1011
#include <logging.h>
12+
#include <policy/feerate.h>
13+
#include <primitives/transaction.h>
14+
#include <random.h>
15+
#include <serialize.h>
1116
#include <streams.h>
17+
#include <sync.h>
18+
#include <tinyformat.h>
1219
#include <txmempool.h>
20+
#include <uint256.h>
1321
#include <util/serfloat.h>
1422
#include <util/system.h>
23+
#include <util/time.h>
24+
25+
#include <algorithm>
26+
#include <cassert>
27+
#include <cmath>
28+
#include <cstddef>
29+
#include <cstdint>
30+
#include <exception>
31+
#include <stdexcept>
32+
#include <utility>
1533

1634
static const char* FEE_ESTIMATES_FILENAME = "fee_estimates.dat";
1735

src/policy/fees.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@
77

88
#include <consensus/amount.h>
99
#include <policy/feerate.h>
10-
#include <uint256.h>
1110
#include <random.h>
1211
#include <sync.h>
12+
#include <threadsafety.h>
13+
#include <uint256.h>
1314

1415
#include <array>
1516
#include <map>
1617
#include <memory>
18+
#include <set>
1719
#include <string>
1820
#include <vector>
1921

2022
class CAutoFile;
21-
class CFeeRate;
2223
class CTxMemPoolEntry;
23-
class CTxMemPool;
2424
class TxConfirmStats;
2525

2626
/* Identifier for each of the 3 different TxConfirmStats which will track

src/policy/packages.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include <consensus/validation.h>
65
#include <policy/packages.h>
6+
#include <policy/policy.h>
77
#include <primitives/transaction.h>
88
#include <uint256.h>
99
#include <util/hasher.h>
1010

11+
#include <algorithm>
12+
#include <cassert>
13+
#include <iterator>
14+
#include <memory>
1115
#include <numeric>
1216
#include <unordered_set>
1317

src/policy/packages.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
#ifndef BITCOIN_POLICY_PACKAGES_H
66
#define BITCOIN_POLICY_PACKAGES_H
77

8+
#include <consensus/consensus.h>
89
#include <consensus/validation.h>
910
#include <policy/policy.h>
1011
#include <primitives/transaction.h>
1112

13+
#include <cstdint>
1214
#include <vector>
1315

1416
/** Default maximum number of transactions in a package. */

src/policy/policy.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@
77

88
#include <policy/policy.h>
99

10-
#include <consensus/validation.h>
1110
#include <coins.h>
11+
#include <consensus/amount.h>
12+
#include <consensus/consensus.h>
13+
#include <consensus/validation.h>
14+
#include <policy/feerate.h>
15+
#include <primitives/transaction.h>
16+
#include <script/interpreter.h>
17+
#include <script/script.h>
18+
#include <script/standard.h>
19+
#include <serialize.h>
1220
#include <span.h>
1321

22+
#include <algorithm>
23+
#include <cstddef>
24+
#include <vector>
25+
1426
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
1527
{
1628
// "Dust" is defined in terms of dustRelayFee,

src/policy/policy.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
#ifndef BITCOIN_POLICY_POLICY_H
77
#define BITCOIN_POLICY_POLICY_H
88

9+
#include <consensus/amount.h>
910
#include <consensus/consensus.h>
10-
#include <policy/feerate.h>
11+
#include <primitives/transaction.h>
1112
#include <script/interpreter.h>
1213
#include <script/standard.h>
1314

15+
#include <cstdint>
1416
#include <string>
1517

1618
class CCoinsViewCache;
17-
class CTxOut;
19+
class CFeeRate;
20+
class CScript;
1821

1922
/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/
2023
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;
5255
* only increase the dust limit after prior releases were already not creating
5356
* outputs below the new threshold */
5457
static const unsigned int DUST_RELAY_TX_FEE = 3000;
58+
/** Default for -minrelaytxfee, minimum relay fee for transactions */
59+
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
5560
/**
5661
* Standard script verification flags that standard transactions will comply
5762
* with. However scripts violating these flags may still be present in valid

0 commit comments

Comments
 (0)