Skip to content

Commit 00fc7cd

Browse files
committed
Merge bitcoin/bitcoin#28200: refactor: Remove unused includes from wallet.cpp
fa62868 Remove unused includes from wallet.cpp (MarcoFalke) fa8fdbe Remove unused includes from blockfilter.h (MarcoFalke) fad8c36 move-only: Create src/kernel/mempool_removal_reason.h (MarcoFalke) fa57608 Remove unused includes from txmempool.h (MarcoFalke) Pull request description: This makes compilation of wallet.cpp use a few % less memory and time, locally. Created in the context of bitcoin/bitcoin#28109, but I don't think it is enough to actually fix this problem. ACKs for top commit: hebasto: ACK fa62868, I have reviewed the code and it looks OK. Tree-SHA512: 06f1120af2a8ef3368dbd9ae747acda88ace2507bd261bcc10341d476a0b3d71c8485377ea6c108b47df3e4c13b7f75a15f486bafa6a8466303168dde16ebbc8
2 parents c00bc63 + fa62868 commit 00fc7cd

18 files changed

+161
-74
lines changed

src/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ BITCOIN_CORE_H = \
190190
kernel/mempool_limits.h \
191191
kernel/mempool_options.h \
192192
kernel/mempool_persist.h \
193+
kernel/mempool_removal_reason.h \
193194
kernel/notifications_interface.h \
194195
kernel/validation_cache_sizes.h \
195196
key.h \
@@ -401,6 +402,7 @@ libbitcoin_node_a_SOURCES = \
401402
kernel/context.cpp \
402403
kernel/cs_main.cpp \
403404
kernel/mempool_persist.cpp \
405+
kernel/mempool_removal_reason.cpp \
404406
mapport.cpp \
405407
net.cpp \
406408
net_processing.cpp \
@@ -940,6 +942,7 @@ libbitcoinkernel_la_SOURCES = \
940942
kernel/context.cpp \
941943
kernel/cs_main.cpp \
942944
kernel/mempool_persist.cpp \
945+
kernel/mempool_removal_reason.cpp \
943946
key.cpp \
944947
logging.cpp \
945948
node/blockstorage.cpp \

src/blockfilter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
#include <blockfilter.h>
99
#include <crypto/siphash.h>
1010
#include <hash.h>
11+
#include <primitives/block.h>
1112
#include <primitives/transaction.h>
1213
#include <script/script.h>
1314
#include <streams.h>
15+
#include <undo.h>
1416
#include <util/golombrice.h>
1517
#include <util/string.h>
1618

src/blockfilter.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
#ifndef BITCOIN_BLOCKFILTER_H
66
#define BITCOIN_BLOCKFILTER_H
77

8-
#include <stdint.h>
9-
#include <string>
8+
#include <cstddef>
9+
#include <cstdint>
10+
#include <ios>
1011
#include <set>
12+
#include <string>
1113
#include <unordered_set>
14+
#include <utility>
1215
#include <vector>
1316

1417
#include <attributes.h>
15-
#include <primitives/block.h>
16-
#include <serialize.h>
1718
#include <uint256.h>
18-
#include <undo.h>
1919
#include <util/bytevectorhash.h>
2020

21+
class CBlock;
22+
class CBlockUndo;
23+
2124
/**
2225
* This implements a Golomb-coded set as defined in BIP 158. It is a
2326
* compact, probabilistic data structure for testing set membership.

src/index/blockfilterindex.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <index/blockfilterindex.h>
1111
#include <logging.h>
1212
#include <node/blockstorage.h>
13+
#include <undo.h>
1314
#include <util/fs_helpers.h>
1415
#include <validation.h>
1516

src/index/blockfilterindex.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <index/base.h>
1313
#include <util/hasher.h>
1414

15+
#include <unordered_map>
16+
1517
static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
1618

1719
/** Interval between compact filter checkpoints. See BIP 157. */

src/kernel/mempool_removal_reason.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) 2016-present The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or https://opensource.org/license/mit/.
4+
5+
#include <kernel/mempool_removal_reason.h>
6+
7+
#include <cassert>
8+
#include <string>
9+
10+
std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept
11+
{
12+
switch (r) {
13+
case MemPoolRemovalReason::EXPIRY: return "expiry";
14+
case MemPoolRemovalReason::SIZELIMIT: return "sizelimit";
15+
case MemPoolRemovalReason::REORG: return "reorg";
16+
case MemPoolRemovalReason::BLOCK: return "block";
17+
case MemPoolRemovalReason::CONFLICT: return "conflict";
18+
case MemPoolRemovalReason::REPLACED: return "replaced";
19+
}
20+
assert(false);
21+
}

src/kernel/mempool_removal_reason.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2016-present The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or https://opensource.org/license/mit/.
4+
5+
#ifndef BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
6+
#define BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
7+
8+
#include <string>
9+
10+
/** Reason why a transaction was removed from the mempool,
11+
* this is passed to the notification signal.
12+
*/
13+
enum class MemPoolRemovalReason {
14+
EXPIRY, //!< Expired from mempool
15+
SIZELIMIT, //!< Removed in size limiting
16+
REORG, //!< Removed for reorganization
17+
BLOCK, //!< Removed for block
18+
CONFLICT, //!< Removed for conflict with in-block transaction
19+
REPLACED, //!< Removed for replacement
20+
};
21+
22+
std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
23+
24+
#endif // BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H

src/node/miner.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
#include <boost/multi_index_container.hpp>
2222

2323
class ArgsManager;
24-
class ChainstateManager;
2524
class CBlockIndex;
2625
class CChainParams;
2726
class CScript;
27+
class Chainstate;
28+
class ChainstateManager;
2829

2930
namespace Consensus { struct Params; };
3031

src/test/blockfilter_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
#include <blockfilter.h>
99
#include <core_io.h>
10+
#include <primitives/block.h>
1011
#include <serialize.h>
1112
#include <streams.h>
13+
#include <undo.h>
1214
#include <univalue.h>
1315
#include <util/strencodings.h>
1416

src/test/miniminer_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44
#include <node/mini_miner.h>
5+
#include <random.h>
56
#include <txmempool.h>
67
#include <util/time.h>
78

0 commit comments

Comments
 (0)