mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-19 05:45:05 +01:00
Merge bitcoin/bitcoin#28200: refactor: Remove unused includes from wallet.cpp
fa6286891f
Remove unused includes from wallet.cpp (MarcoFalke)fa8fdbe229
Remove unused includes from blockfilter.h (MarcoFalke)fad8c36aa9
move-only: Create src/kernel/mempool_removal_reason.h (MarcoFalke)fa57608800
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 https://github.com/bitcoin/bitcoin/issues/28109, but I don't think it is enough to actually fix this problem. ACKs for top commit: hebasto: ACKfa6286891f
, I have reviewed the code and it looks OK. Tree-SHA512: 06f1120af2a8ef3368dbd9ae747acda88ace2507bd261bcc10341d476a0b3d71c8485377ea6c108b47df3e4c13b7f75a15f486bafa6a8466303168dde16ebbc8
This commit is contained in:
commit
00fc7cdc25
@ -190,6 +190,7 @@ BITCOIN_CORE_H = \
|
||||
kernel/mempool_limits.h \
|
||||
kernel/mempool_options.h \
|
||||
kernel/mempool_persist.h \
|
||||
kernel/mempool_removal_reason.h \
|
||||
kernel/notifications_interface.h \
|
||||
kernel/validation_cache_sizes.h \
|
||||
key.h \
|
||||
@ -401,6 +402,7 @@ libbitcoin_node_a_SOURCES = \
|
||||
kernel/context.cpp \
|
||||
kernel/cs_main.cpp \
|
||||
kernel/mempool_persist.cpp \
|
||||
kernel/mempool_removal_reason.cpp \
|
||||
mapport.cpp \
|
||||
net.cpp \
|
||||
net_processing.cpp \
|
||||
@ -940,6 +942,7 @@ libbitcoinkernel_la_SOURCES = \
|
||||
kernel/context.cpp \
|
||||
kernel/cs_main.cpp \
|
||||
kernel/mempool_persist.cpp \
|
||||
kernel/mempool_removal_reason.cpp \
|
||||
key.cpp \
|
||||
logging.cpp \
|
||||
node/blockstorage.cpp \
|
||||
|
@ -8,9 +8,11 @@
|
||||
#include <blockfilter.h>
|
||||
#include <crypto/siphash.h>
|
||||
#include <hash.h>
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/script.h>
|
||||
#include <streams.h>
|
||||
#include <undo.h>
|
||||
#include <util/golombrice.h>
|
||||
#include <util/string.h>
|
||||
|
||||
|
@ -5,19 +5,22 @@
|
||||
#ifndef BITCOIN_BLOCKFILTER_H
|
||||
#define BITCOIN_BLOCKFILTER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <ios>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <attributes.h>
|
||||
#include <primitives/block.h>
|
||||
#include <serialize.h>
|
||||
#include <uint256.h>
|
||||
#include <undo.h>
|
||||
#include <util/bytevectorhash.h>
|
||||
|
||||
class CBlock;
|
||||
class CBlockUndo;
|
||||
|
||||
/**
|
||||
* This implements a Golomb-coded set as defined in BIP 158. It is a
|
||||
* compact, probabilistic data structure for testing set membership.
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <index/blockfilterindex.h>
|
||||
#include <logging.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <undo.h>
|
||||
#include <util/fs_helpers.h>
|
||||
#include <validation.h>
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include <index/base.h>
|
||||
#include <util/hasher.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
|
||||
|
||||
/** Interval between compact filter checkpoints. See BIP 157. */
|
||||
|
21
src/kernel/mempool_removal_reason.cpp
Normal file
21
src/kernel/mempool_removal_reason.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) 2016-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#include <kernel/mempool_removal_reason.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept
|
||||
{
|
||||
switch (r) {
|
||||
case MemPoolRemovalReason::EXPIRY: return "expiry";
|
||||
case MemPoolRemovalReason::SIZELIMIT: return "sizelimit";
|
||||
case MemPoolRemovalReason::REORG: return "reorg";
|
||||
case MemPoolRemovalReason::BLOCK: return "block";
|
||||
case MemPoolRemovalReason::CONFLICT: return "conflict";
|
||||
case MemPoolRemovalReason::REPLACED: return "replaced";
|
||||
}
|
||||
assert(false);
|
||||
}
|
24
src/kernel/mempool_removal_reason.h
Normal file
24
src/kernel/mempool_removal_reason.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2016-present The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#ifndef BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
|
||||
#define BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
|
||||
|
||||
#include <string>
|
||||
|
||||
/** Reason why a transaction was removed from the mempool,
|
||||
* this is passed to the notification signal.
|
||||
*/
|
||||
enum class MemPoolRemovalReason {
|
||||
EXPIRY, //!< Expired from mempool
|
||||
SIZELIMIT, //!< Removed in size limiting
|
||||
REORG, //!< Removed for reorganization
|
||||
BLOCK, //!< Removed for block
|
||||
CONFLICT, //!< Removed for conflict with in-block transaction
|
||||
REPLACED, //!< Removed for replacement
|
||||
};
|
||||
|
||||
std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
|
||||
|
||||
#endif // BITCOIN_KERNEL_MEMPOOL_REMOVAL_REASON_H
|
@ -21,10 +21,11 @@
|
||||
#include <boost/multi_index_container.hpp>
|
||||
|
||||
class ArgsManager;
|
||||
class ChainstateManager;
|
||||
class CBlockIndex;
|
||||
class CChainParams;
|
||||
class CScript;
|
||||
class Chainstate;
|
||||
class ChainstateManager;
|
||||
|
||||
namespace Consensus { struct Params; };
|
||||
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
#include <blockfilter.h>
|
||||
#include <core_io.h>
|
||||
#include <primitives/block.h>
|
||||
#include <serialize.h>
|
||||
#include <streams.h>
|
||||
#include <undo.h>
|
||||
#include <univalue.h>
|
||||
#include <util/strencodings.h>
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#include <node/mini_miner.h>
|
||||
#include <random.h>
|
||||
#include <txmempool.h>
|
||||
#include <util/time.h>
|
||||
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <primitives/block.h>
|
||||
#include <undo.h>
|
||||
#include <validation.h>
|
||||
|
||||
using node::BlockManager;
|
||||
|
@ -1197,19 +1197,6 @@ void CTxMemPool::SetLoadTried(bool load_tried)
|
||||
m_load_tried = load_tried;
|
||||
}
|
||||
|
||||
std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept
|
||||
{
|
||||
switch (r) {
|
||||
case MemPoolRemovalReason::EXPIRY: return "expiry";
|
||||
case MemPoolRemovalReason::SIZELIMIT: return "sizelimit";
|
||||
case MemPoolRemovalReason::REORG: return "reorg";
|
||||
case MemPoolRemovalReason::BLOCK: return "block";
|
||||
case MemPoolRemovalReason::CONFLICT: return "conflict";
|
||||
case MemPoolRemovalReason::REPLACED: return "replaced";
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
|
||||
std::vector<CTxMemPool::txiter> CTxMemPool::GatherClusters(const std::vector<uint256>& txids) const
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
|
@ -6,27 +6,17 @@
|
||||
#ifndef BITCOIN_TXMEMPOOL_H
|
||||
#define BITCOIN_TXMEMPOOL_H
|
||||
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <kernel/mempool_limits.h>
|
||||
#include <kernel/mempool_options.h>
|
||||
|
||||
#include <coins.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <indirectmap.h>
|
||||
#include <kernel/cs_main.h>
|
||||
#include <kernel/mempool_entry.h>
|
||||
#include <kernel/mempool_entry.h> // IWYU pragma: export
|
||||
#include <kernel/mempool_limits.h> // IWYU pragma: export
|
||||
#include <kernel/mempool_options.h> // IWYU pragma: export
|
||||
#include <kernel/mempool_removal_reason.h> // IWYU pragma: export
|
||||
#include <policy/feerate.h>
|
||||
#include <policy/packages.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <random.h>
|
||||
#include <sync.h>
|
||||
#include <util/epochguard.h>
|
||||
#include <util/hasher.h>
|
||||
@ -40,9 +30,16 @@
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
|
||||
class CBlockIndex;
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class CChain;
|
||||
class Chainstate;
|
||||
|
||||
/** Fake height value used in Coin to signify they are only in the memory pool (since 0.8) */
|
||||
static const uint32_t MEMPOOL_HEIGHT = 0x7FFFFFFF;
|
||||
@ -228,20 +225,6 @@ struct TxMempoolInfo
|
||||
int64_t nFeeDelta;
|
||||
};
|
||||
|
||||
/** Reason why a transaction was removed from the mempool,
|
||||
* this is passed to the notification signal.
|
||||
*/
|
||||
enum class MemPoolRemovalReason {
|
||||
EXPIRY, //!< Expired from mempool
|
||||
SIZELIMIT, //!< Removed in size limiting
|
||||
REORG, //!< Removed for reorganization
|
||||
BLOCK, //!< Removed for block
|
||||
CONFLICT, //!< Removed for conflict with in-block transaction
|
||||
REPLACED, //!< Removed for replacement
|
||||
};
|
||||
|
||||
std::string RemovalReasonToString(const MemPoolRemovalReason& r) noexcept;
|
||||
|
||||
/**
|
||||
* CTxMemPool stores valid-according-to-the-current-best-chain transactions
|
||||
* that may be included in the next block.
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <key_io.h>
|
||||
#include <streams.h>
|
||||
#include <test/util/setup_common.h>
|
||||
#include <validationinterface.h>
|
||||
#include <wallet/context.h>
|
||||
#include <wallet/wallet.h>
|
||||
#include <wallet/walletdb.h>
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <test/util/setup_common.h>
|
||||
#include <util/translation.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
#include <wallet/context.h>
|
||||
#include <wallet/receive.h>
|
||||
|
@ -5,51 +5,82 @@
|
||||
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config/bitcoin-config.h>
|
||||
#endif
|
||||
#include <addresstype.h>
|
||||
#include <blockfilter.h>
|
||||
#include <chain.h>
|
||||
#include <coins.h>
|
||||
#include <common/args.h>
|
||||
#include <common/settings.h>
|
||||
#include <common/system.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <consensus/consensus.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <external_signer.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/wallet.h>
|
||||
#include <kernel/mempool_removal_reason.h>
|
||||
#include <key.h>
|
||||
#include <key_io.h>
|
||||
#include <logging.h>
|
||||
#include <outputtype.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/policy.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <psbt.h>
|
||||
#include <pubkey.h>
|
||||
#include <random.h>
|
||||
#include <script/descriptor.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <script/script.h>
|
||||
#include <script/sign.h>
|
||||
#include <script/signingprovider.h>
|
||||
#include <script/solver.h>
|
||||
#include <serialize.h>
|
||||
#include <span.h>
|
||||
#include <streams.h>
|
||||
#include <support/allocators/secure.h>
|
||||
#include <support/allocators/zeroafterfree.h>
|
||||
#include <support/cleanse.h>
|
||||
#include <txmempool.h>
|
||||
#include <util/bip32.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
#include <univalue.h>
|
||||
#include <util/check.h>
|
||||
#include <util/error.h>
|
||||
#include <util/fees.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/fs_helpers.h>
|
||||
#include <util/message.h>
|
||||
#include <util/moneystr.h>
|
||||
#include <util/rbf.h>
|
||||
#include <util/result.h>
|
||||
#include <util/string.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
#include <wallet/coincontrol.h>
|
||||
#include <wallet/context.h>
|
||||
#include <wallet/crypter.h>
|
||||
#include <wallet/db.h>
|
||||
#include <wallet/external_signer_scriptpubkeyman.h>
|
||||
#include <wallet/fees.h>
|
||||
#include <wallet/scriptpubkeyman.h>
|
||||
|
||||
#include <univalue.h>
|
||||
#include <wallet/transaction.h>
|
||||
#include <wallet/types.h>
|
||||
#include <wallet/walletdb.h>
|
||||
#include <wallet/walletutil.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <condition_variable>
|
||||
#include <exception>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
#include <tuple>
|
||||
#include <variant>
|
||||
|
||||
struct KeyOriginInfo;
|
||||
|
||||
using interfaces::FoundBlock;
|
||||
|
||||
|
@ -10,47 +10,72 @@
|
||||
#include <consensus/amount.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <interfaces/wallet.h>
|
||||
#include <kernel/cs_main.h>
|
||||
#include <logging.h>
|
||||
#include <outputtype.h>
|
||||
#include <policy/feerate.h>
|
||||
#include <psbt.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/interpreter.h>
|
||||
#include <script/script.h>
|
||||
#include <support/allocators/secure.h>
|
||||
#include <sync.h>
|
||||
#include <tinyformat.h>
|
||||
#include <uint256.h>
|
||||
#include <util/fs.h>
|
||||
#include <util/hasher.h>
|
||||
#include <util/message.h>
|
||||
#include <util/result.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/string.h>
|
||||
#include <util/time.h>
|
||||
#include <util/ui_change_type.h>
|
||||
#include <validationinterface.h>
|
||||
#include <wallet/crypter.h>
|
||||
#include <wallet/db.h>
|
||||
#include <wallet/scriptpubkeyman.h>
|
||||
#include <wallet/transaction.h>
|
||||
#include <wallet/walletdb.h>
|
||||
#include <wallet/types.h>
|
||||
#include <wallet/walletutil.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/signals2/signal.hpp>
|
||||
|
||||
class CKey;
|
||||
class CKeyID;
|
||||
class CPubKey;
|
||||
class Coin;
|
||||
class SigningProvider;
|
||||
enum class MemPoolRemovalReason;
|
||||
enum class SigningResult;
|
||||
enum class TransactionError;
|
||||
namespace interfaces {
|
||||
class Wallet;
|
||||
}
|
||||
namespace wallet {
|
||||
class CWallet;
|
||||
class WalletBatch;
|
||||
enum class DBErrors : int;
|
||||
} // namespace wallet
|
||||
struct CBlockLocator;
|
||||
struct CExtKey;
|
||||
struct FlatSigningProvider;
|
||||
struct KeyOriginInfo;
|
||||
struct PartiallySignedTransaction;
|
||||
struct SignatureData;
|
||||
|
||||
using LoadWalletFn = std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
|
||||
|
||||
class CScript;
|
||||
enum class FeeEstimateMode;
|
||||
struct bilingual_str;
|
||||
|
||||
namespace wallet {
|
||||
@ -119,8 +144,6 @@ constexpr CAmount HIGH_MAX_TX_FEE{100 * HIGH_TX_FEE_PER_KB};
|
||||
static constexpr size_t DUMMY_NESTED_P2WPKH_INPUT_SIZE = 91;
|
||||
|
||||
class CCoinControl;
|
||||
class CWalletTx;
|
||||
class ReserveDestination;
|
||||
|
||||
//! Default for -addresstype
|
||||
constexpr OutputType DEFAULT_ADDRESS_TYPE{OutputType::BECH32};
|
||||
|
@ -19,7 +19,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES = (
|
||||
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel",
|
||||
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog",
|
||||
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel",
|
||||
"wallet/fees -> wallet/wallet -> wallet/fees",
|
||||
"wallet/wallet -> wallet/walletdb -> wallet/wallet",
|
||||
"kernel/coinstats -> validation -> kernel/coinstats",
|
||||
"kernel/mempool_persist -> validation -> kernel/mempool_persist",
|
||||
|
Loading…
Reference in New Issue
Block a user