aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-07-19 21:43:52 +0100
committerfanquake <fanquake@gmail.com>2022-07-19 21:54:52 +0100
commit5560682a4464852eb3c244c1ddf9eea02dc962b2 (patch)
treeac226d4c05e7f86dee2b9d84620b9696b015e483
parent92c8e1849dceea6d4f7de2b58f4c50e5e50762ea (diff)
parentfaf98aecf876fae0ec6d4d16b7e66f3a35253180 (diff)
downloadbitcoin-5560682a4464852eb3c244c1ddf9eea02dc962b2.tar.xz
Merge bitcoin/bitcoin#25645: refactor: Remove unused includes from dbwrapper.h
faf98aecf876fae0ec6d4d16b7e66f3a35253180 Remove unused includes in rpc/fees.cpp (MacroFake) 1111ddeedf7ea801507db4e23b4737ec183eb19c Remove unused includes from dbwrapper.h (MacroFake) fa77fdd0475fa15a1a3641c5d5a2bf7ad095aa84 Add missing includes (MacroFake) fa869ce2c2b906d8b087c4e7a5f1804a74b1c522 Add missing includes to node/chainstate (MacroFake) Pull request description: Unused includes are confusing, but also cause unrelated compile errors when the unused includes were to be removed. Fix that by adding the missing includes where they are needed and then remove them where they are not needed. This is also checked by iwyu. ACKs for top commit: hebasto: ACK faf98aecf876fae0ec6d4d16b7e66f3a35253180, I have reviewed the code and it looks OK, I agree it can be merged. jarolrod: Code Review ACK https://github.com/bitcoin/bitcoin/commit/faf98aecf876fae0ec6d4d16b7e66f3a35253180 Tree-SHA512: 75f3c6e6f6ecf8a98233e1a1463c75ca4e0eb3ec341150d274141072fe95413a3c2ec6386d1c527899cc63d43f63f5eb5991509847412773362808ddfb1bb435
-rwxr-xr-xci/test/06_script_b.sh2
-rw-r--r--src/bench/checkblock.cpp1
-rw-r--r--src/dbwrapper.cpp19
-rw-r--r--src/dbwrapper.h16
-rw-r--r--src/index/base.cpp1
-rw-r--r--src/index/coinstatsindex.cpp1
-rw-r--r--src/node/chainstate.cpp13
-rw-r--r--src/node/chainstate.h3
-rw-r--r--src/qt/optionsdialog.cpp1
-rw-r--r--src/rpc/blockchain.cpp1
-rw-r--r--src/rpc/fees.cpp2
-rw-r--r--src/rpc/mempool.cpp1
-rw-r--r--src/txdb.h1
13 files changed, 52 insertions, 10 deletions
diff --git a/ci/test/06_script_b.sh b/ci/test/06_script_b.sh
index 77358f93d9..29f30cfe9e 100755
--- a/ci/test/06_script_b.sh
+++ b/ci/test/06_script_b.sh
@@ -40,8 +40,10 @@ if [ "${RUN_TIDY}" = "true" ]; then
export P_CI_DIR="${BASE_BUILD_DIR}/bitcoin-$HOST/"
CI_EXEC "python3 ${DIR_IWYU}/include-what-you-use/iwyu_tool.py"\
" src/compat"\
+ " src/dbwrapper.cpp"\
" src/init"\
" src/kernel/mempool_persist.cpp"\
+ " src/node/chainstate.cpp"\
" src/policy/feerate.cpp"\
" src/policy/packages.cpp"\
" src/policy/settings.cpp"\
diff --git a/src/bench/checkblock.cpp b/src/bench/checkblock.cpp
index 52e5cb743f..53aa470042 100644
--- a/src/bench/checkblock.cpp
+++ b/src/bench/checkblock.cpp
@@ -8,6 +8,7 @@
#include <chainparams.h>
#include <consensus/validation.h>
#include <streams.h>
+#include <util/system.h>
#include <validation.h>
// These are the two major time-sinks which happen after we have fully received
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp
index d4a8e4f35a..4dbc839941 100644
--- a/src/dbwrapper.cpp
+++ b/src/dbwrapper.cpp
@@ -4,15 +4,28 @@
#include <dbwrapper.h>
-#include <memory>
+#include <fs.h>
+#include <logging.h>
#include <random.h>
+#include <tinyformat.h>
+#include <util/strencodings.h>
+#include <util/system.h>
+#include <algorithm>
+#include <cassert>
+#include <cstdarg>
+#include <cstdint>
+#include <cstdio>
#include <leveldb/cache.h>
+#include <leveldb/db.h>
#include <leveldb/env.h>
#include <leveldb/filter_policy.h>
#include <leveldb/helpers/memenv/memenv.h>
-#include <stdint.h>
-#include <algorithm>
+#include <leveldb/iterator.h>
+#include <leveldb/options.h>
+#include <leveldb/status.h>
+#include <memory>
+#include <optional>
class CBitcoinLevelDBLogger : public leveldb::Logger {
public:
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index cef8426d61..665eaa0e98 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -7,14 +7,26 @@
#include <clientversion.h>
#include <fs.h>
+#include <logging.h>
#include <serialize.h>
#include <span.h>
#include <streams.h>
-#include <util/strencodings.h>
-#include <util/system.h>
+#include <cstddef>
+#include <cstdint>
+#include <exception>
#include <leveldb/db.h>
+#include <leveldb/iterator.h>
+#include <leveldb/options.h>
+#include <leveldb/slice.h>
+#include <leveldb/status.h>
#include <leveldb/write_batch.h>
+#include <stdexcept>
+#include <string>
+#include <vector>
+namespace leveldb {
+class Env;
+}
static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64;
static const size_t DBWRAPPER_PREALLOC_VALUE_SIZE = 1024;
diff --git a/src/index/base.cpp b/src/index/base.cpp
index 4f399620e4..2368189da2 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -12,6 +12,7 @@
#include <shutdown.h>
#include <tinyformat.h>
#include <util/syscall_sandbox.h>
+#include <util/system.h>
#include <util/thread.h>
#include <util/translation.h>
#include <validation.h> // For g_chainman
diff --git a/src/index/coinstatsindex.cpp b/src/index/coinstatsindex.cpp
index b722118b2e..b9029e946a 100644
--- a/src/index/coinstatsindex.cpp
+++ b/src/index/coinstatsindex.cpp
@@ -10,6 +10,7 @@
#include <serialize.h>
#include <txdb.h>
#include <undo.h>
+#include <util/system.h>
#include <validation.h>
using kernel::CCoinsStats;
diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp
index 54ba5b7966..60a60f8665 100644
--- a/src/node/chainstate.cpp
+++ b/src/node/chainstate.cpp
@@ -4,10 +4,23 @@
#include <node/chainstate.h>
+#include <chain.h>
+#include <coins.h>
#include <consensus/params.h>
#include <node/blockstorage.h>
+#include <sync.h>
+#include <threadsafety.h>
+#include <txdb.h>
+#include <uint256.h>
+#include <util/time.h>
#include <validation.h>
+#include <algorithm>
+#include <atomic>
+#include <cassert>
+#include <memory>
+#include <vector>
+
namespace node {
std::optional<ChainstateLoadingError> LoadChainstate(bool fReset,
ChainstateManager& chainman,
diff --git a/src/node/chainstate.h b/src/node/chainstate.h
index ff7935e8e0..5c495da229 100644
--- a/src/node/chainstate.h
+++ b/src/node/chainstate.h
@@ -11,9 +11,6 @@
class ChainstateManager;
class CTxMemPool;
-namespace Consensus {
-struct Params;
-} // namespace Consensus
namespace node {
enum class ChainstateLoadingError {
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 42c8b07763..2b6711ca40 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -19,6 +19,7 @@
#include <validation.h> // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
#include <netbase.h>
#include <txdb.h> // for -dbcache defaults
+#include <util/system.h>
#include <chrono>
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 52d5eaaa50..88ceeadea4 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -39,6 +39,7 @@
#include <univalue.h>
#include <util/check.h>
#include <util/strencodings.h>
+#include <util/system.h>
#include <util/translation.h>
#include <validation.h>
#include <validationinterface.h>
diff --git a/src/rpc/fees.cpp b/src/rpc/fees.cpp
index dd1a6441a0..41f386d443 100644
--- a/src/rpc/fees.cpp
+++ b/src/rpc/fees.cpp
@@ -6,7 +6,6 @@
#include <core_io.h>
#include <policy/feerate.h>
#include <policy/fees.h>
-#include <policy/policy.h>
#include <policy/settings.h>
#include <rpc/protocol.h>
#include <rpc/request.h>
@@ -16,7 +15,6 @@
#include <txmempool.h>
#include <univalue.h>
#include <util/fees.h>
-#include <util/system.h>
#include <algorithm>
#include <array>
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index d59ff3f75c..0ae10b6c39 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -20,6 +20,7 @@
#include <txmempool.h>
#include <univalue.h>
#include <util/moneystr.h>
+#include <util/time.h>
using kernel::DumpMempool;
diff --git a/src/txdb.h b/src/txdb.h
index faa543b412..a04596f7bb 100644
--- a/src/txdb.h
+++ b/src/txdb.h
@@ -8,6 +8,7 @@
#include <coins.h>
#include <dbwrapper.h>
+#include <sync.h>
#include <memory>
#include <optional>