Skip to content

Commit

Permalink
Merge #25645: refactor: Remove unused includes from dbwrapper.h
Browse files Browse the repository at this point in the history
faf98ae Remove unused includes in rpc/fees.cpp (MacroFake)
1111dde Remove unused includes from dbwrapper.h (MacroFake)
fa77fdd Add missing includes (MacroFake)
fa869ce 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 faf98ae, I have reviewed the code and it looks OK, I agree it can be merged.
  jarolrod:
    Code Review ACK faf98ae

Tree-SHA512: 75f3c6e6f6ecf8a98233e1a1463c75ca4e0eb3ec341150d274141072fe95413a3c2ec6386d1c527899cc63d43f63f5eb5991509847412773362808ddfb1bb435
  • Loading branch information
fanquake committed Jul 19, 2022
2 parents 92c8e18 + faf98ae commit 5560682
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 10 deletions.
2 changes: 2 additions & 0 deletions ci/test/06_script_b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"\
Expand Down
1 change: 1 addition & 0 deletions src/bench/checkblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions src/dbwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 14 additions & 2 deletions src/dbwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/index/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/index/coinstatsindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <serialize.h>
#include <txdb.h>
#include <undo.h>
#include <util/system.h>
#include <validation.h>

using kernel::CCoinsStats;
Expand Down
13 changes: 13 additions & 0 deletions src/node/chainstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 0 additions & 3 deletions src/node/chainstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

class ChainstateManager;
class CTxMemPool;
namespace Consensus {
struct Params;
} // namespace Consensus

namespace node {
enum class ChainstateLoadingError {
Expand Down
1 change: 1 addition & 0 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 0 additions & 2 deletions src/rpc/fees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -16,7 +15,6 @@
#include <txmempool.h>
#include <univalue.h>
#include <util/fees.h>
#include <util/system.h>

#include <algorithm>
#include <array>
Expand Down
1 change: 1 addition & 0 deletions src/rpc/mempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <txmempool.h>
#include <univalue.h>
#include <util/moneystr.h>
#include <util/time.h>

using kernel::DumpMempool;

Expand Down
1 change: 1 addition & 0 deletions src/txdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <coins.h>
#include <dbwrapper.h>
#include <sync.h>

#include <memory>
#include <optional>
Expand Down

0 comments on commit 5560682

Please sign in to comment.