Merge bitcoin/bitcoin#31308: ci, iwyu: Treat warnings as errors for specific directories
02d2b5a11cci, iwyu: Treat warnings as errors for specific directories (Hennadii Stepanov)57a3eac387refactor: Fix includes in `index` directory (Hennadii Stepanov)bdb8eadcdcrefactor: Fix includes in `crypto` directory (Hennadii Stepanov)56f2a689a2ci: Do not patch `leveldb` to workaround UB in "tidy" CI job (Hennadii Stepanov) Pull request description: This PR is the first step towards treating IWYU warnings as errors. At this stage, it applies only to the `crypto` and `index` directories. ACKs for top commit: maflcko: re-ACK02d2b5a11c💮 ryanofsky: Code review ACK02d2b5a11c. Just rebased and update tidy patch comment again since last review willcl-ark: ACK02d2b5a11cTree-SHA512: 1c966e01c47bf3e7d225faa3b819367f757430e2d71e9582fa82d67307aabe3f0d76f69346ee180192e7f5ab194ecc58d2b8ecf178eab26ba3309a6b55bff4b6
This commit is contained in:
33 files changed
+214
-64
No files matched your search
@@ -41,7 +41,10 @@ echo "=== BEGIN env ==="
|
|||||||
env
|
env
|
||||||
echo "=== END env ==="
|
echo "=== END env ==="
|
||||||
|
|
||||||
(
|
# Don't apply patches in the tidy job, because it relies on the `git diff`
|
||||||
|
# command to detect IWYU errors. It is safe to skip this patch in the tidy job
|
||||||
|
# because it doesn't run a UB detector.
|
||||||
|
if [ "$RUN_TIDY" != "true" ]; then
|
||||||
# compact->outputs[i].file_size is uninitialized memory, so reading it is UB.
|
# compact->outputs[i].file_size is uninitialized memory, so reading it is UB.
|
||||||
# The statistic bytes_written is only used for logging, which is disabled in
|
# The statistic bytes_written is only used for logging, which is disabled in
|
||||||
# CI, so as a temporary minimal fix to work around UB and CI failures, leave
|
# CI, so as a temporary minimal fix to work around UB and CI failures, leave
|
||||||
@@ -62,7 +65,7 @@ echo "=== END env ==="
|
|||||||
mutex_.Lock();
|
mutex_.Lock();
|
||||||
stats_[compact->compaction->level() + 1].Add(stats);
|
stats_[compact->compaction->level() + 1].Add(stats);
|
||||||
EOF
|
EOF
|
||||||
)
|
fi
|
||||||
|
|
||||||
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
|
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
|
||||||
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_corpora/
|
export DIR_FUZZ_IN=${DIR_QA_ASSETS}/fuzz_corpora/
|
||||||
@@ -211,14 +214,30 @@ if [ "${RUN_TIDY}" = "true" ]; then
|
|||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: Consider enforcing IWYU across the entire codebase.
|
||||||
|
FILES_WITH_ENFORCED_IWYU="/src/(crypto|index)/.*\\.cpp"
|
||||||
|
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns)))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_errors.json"
|
||||||
|
jq --arg patterns "$FILES_WITH_ENFORCED_IWYU" 'map(select(.file | test($patterns) | not))' "${BASE_BUILD_DIR}/compile_commands.json" > "${BASE_BUILD_DIR}/compile_commands_iwyu_warnings.json"
|
||||||
|
|
||||||
cd "${BASE_ROOT_DIR}"
|
cd "${BASE_ROOT_DIR}"
|
||||||
python3 "/include-what-you-use/iwyu_tool.py" \
|
|
||||||
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
run_iwyu() {
|
||||||
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
mv "${BASE_BUILD_DIR}/$1" "${BASE_BUILD_DIR}/compile_commands.json"
|
||||||
-Xiwyu --max_line_length=160 \
|
python3 "/include-what-you-use/iwyu_tool.py" \
|
||||||
2>&1 | tee /tmp/iwyu_ci.out
|
-p "${BASE_BUILD_DIR}" "${MAKEJOBS}" \
|
||||||
cd "${BASE_ROOT_DIR}/src"
|
-- -Xiwyu --cxx17ns -Xiwyu --mapping_file="${BASE_ROOT_DIR}/contrib/devtools/iwyu/bitcoin.core.imp" \
|
||||||
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
-Xiwyu --max_line_length=160 \
|
||||||
|
2>&1 | tee /tmp/iwyu_ci.out
|
||||||
|
python3 "/include-what-you-use/fix_includes.py" --nosafe_headers < /tmp/iwyu_ci.out
|
||||||
|
}
|
||||||
|
|
||||||
|
run_iwyu "compile_commands_iwyu_errors.json"
|
||||||
|
if ! ( git --no-pager diff --exit-code ); then
|
||||||
|
echo "^^^ ⚠️ Failure generated from IWYU"
|
||||||
|
false
|
||||||
|
fi
|
||||||
|
|
||||||
|
run_iwyu "compile_commands_iwyu_warnings.json"
|
||||||
git --no-pager diff
|
git --no-pager diff
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
# Nothing for now.
|
|
||||||
[
|
[
|
||||||
|
# Compiler intrinsics.
|
||||||
|
# See: https://github.com/include-what-you-use/include-what-you-use/issues/1764.
|
||||||
|
{ "include": [ "<emmintrin.h>", "private", "<immintrin.h>", "public" ] },
|
||||||
|
{ "include": [ "<smmintrin.h>", "private", "<immintrin.h>", "public" ] },
|
||||||
|
{ "include": [ "<tmmintrin.h>", "private", "<immintrin.h>", "public" ] },
|
||||||
|
|
||||||
|
# libc symbols.
|
||||||
|
{ "symbol": ["AT_HWCAP", "private", "<sys/auxv.h>", "public"] },
|
||||||
|
{ "symbol": ["AT_HWCAP2", "private", "<sys/auxv.h>", "public"] },
|
||||||
|
|
||||||
|
# Fixed in https://github.com/include-what-you-use/include-what-you-use/pull/1706.
|
||||||
|
{ "symbol": ["SEEK_CUR", "private", "<cstdio>", "public"] },
|
||||||
|
{ "symbol": ["SEEK_END", "private", "<cstdio>", "public"] },
|
||||||
|
{ "symbol": ["SEEK_SET", "private", "<cstdio>", "public"] },
|
||||||
]
|
]
|
||||||
@@ -8,11 +8,10 @@
|
|||||||
#include <crypto/common.h>
|
#include <crypto/common.h>
|
||||||
#include <crypto/chacha20.h>
|
#include <crypto/chacha20.h>
|
||||||
#include <support/cleanse.h>
|
#include <support/cleanse.h>
|
||||||
#include <span.h>
|
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include <cstring>
|
#include <cassert>
|
||||||
|
|
||||||
#define QUARTERROUND(a,b,c,d) \
|
#define QUARTERROUND(a,b,c,d) \
|
||||||
a += b; d = std::rotl(d ^ a, 16); \
|
a += b; d = std::rotl(d ^ a, 16); \
|
||||||
|
|||||||
@@ -5,12 +5,11 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_CHACHA20_H
|
#ifndef BITCOIN_CRYPTO_CHACHA20_H
|
||||||
#define BITCOIN_CRYPTO_CHACHA20_H
|
#define BITCOIN_CRYPTO_CHACHA20_H
|
||||||
|
|
||||||
#include <span.h>
|
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <iterator>
|
||||||
|
#include <span>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
// classes for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
|
// classes for ChaCha20 256-bit stream cipher developed by Daniel J. Bernstein
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
#include <crypto/chacha20.h>
|
#include <crypto/chacha20.h>
|
||||||
#include <crypto/poly1305.h>
|
#include <crypto/poly1305.h>
|
||||||
#include <span.h>
|
|
||||||
|
|
||||||
/** The AEAD_CHACHA20_POLY1305 authenticated encryption algorithm from RFC8439 section 2.8. */
|
/** The AEAD_CHACHA20_POLY1305 authenticated encryption algorithm from RFC8439 section 2.8. */
|
||||||
class AEADChaCha20Poly1305
|
class AEADChaCha20Poly1305
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
#include <crypto/hex_base.h>
|
#include <crypto/hex_base.h>
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cassert>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
|
|
||||||
#include <crypto/hkdf_sha256_32.h>
|
#include <crypto/hkdf_sha256_32.h>
|
||||||
|
|
||||||
|
#include <crypto/hmac_sha256.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const unsigned char* ikm, size_t ikmlen, const std::string& salt)
|
CHKDF_HMAC_SHA256_L32::CHKDF_HMAC_SHA256_L32(const unsigned char* ikm, size_t ikmlen, const std::string& salt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,10 +5,8 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_HKDF_SHA256_32_H
|
#ifndef BITCOIN_CRYPTO_HKDF_SHA256_32_H
|
||||||
#define BITCOIN_CRYPTO_HKDF_SHA256_32_H
|
#define BITCOIN_CRYPTO_HKDF_SHA256_32_H
|
||||||
|
|
||||||
#include <crypto/hmac_sha256.h>
|
#include <cstddef>
|
||||||
|
#include <string>
|
||||||
#include <cstdint>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
|
/** A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes (L=32) */
|
||||||
class CHKDF_HMAC_SHA256_L32
|
class CHKDF_HMAC_SHA256_L32
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include <crypto/hmac_sha256.h>
|
#include <crypto/hmac_sha256.h>
|
||||||
|
|
||||||
|
#include <crypto/sha256.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen)
|
CHMAC_SHA256::CHMAC_SHA256(const unsigned char* key, size_t keylen)
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
#include <crypto/sha256.h>
|
#include <crypto/sha256.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstddef>
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
/** A hasher class for HMAC-SHA-256. */
|
/** A hasher class for HMAC-SHA-256. */
|
||||||
class CHMAC_SHA256
|
class CHMAC_SHA256
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include <crypto/hmac_sha512.h>
|
#include <crypto/hmac_sha512.h>
|
||||||
|
|
||||||
|
#include <crypto/sha512.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
|
CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
|
|
||||||
#include <crypto/sha512.h>
|
#include <crypto/sha512.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstddef>
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
/** A hasher class for HMAC-SHA-512. */
|
/** A hasher class for HMAC-SHA-512. */
|
||||||
class CHMAC_SHA512
|
class CHMAC_SHA512
|
||||||
|
|||||||
@@ -7,11 +7,12 @@
|
|||||||
#include <crypto/chacha20.h>
|
#include <crypto/chacha20.h>
|
||||||
#include <crypto/common.h>
|
#include <crypto/common.h>
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
|
#include <span.h>
|
||||||
|
#include <uint256.h>
|
||||||
#include <util/check.h>
|
#include <util/check.h>
|
||||||
|
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include <cassert>
|
#include <cstring>
|
||||||
#include <cstdio>
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
+4
-1
@@ -6,9 +6,12 @@
|
|||||||
#define BITCOIN_CRYPTO_MUHASH_H
|
#define BITCOIN_CRYPTO_MUHASH_H
|
||||||
|
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
#include <uint256.h>
|
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
|
class uint256;
|
||||||
|
|
||||||
class Num3072
|
class Num3072
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,8 +5,6 @@
|
|||||||
#include <crypto/common.h>
|
#include <crypto/common.h>
|
||||||
#include <crypto/poly1305.h>
|
#include <crypto/poly1305.h>
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
namespace poly1305_donna {
|
namespace poly1305_donna {
|
||||||
|
|
||||||
// Based on the public domain implementation by Andrew Moon
|
// Based on the public domain implementation by Andrew Moon
|
||||||
|
|||||||
@@ -8,8 +8,9 @@
|
|||||||
#include <span.h>
|
#include <span.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <span>
|
||||||
|
|
||||||
#define POLY1305_BLOCK_SIZE 16
|
#define POLY1305_BLOCK_SIZE 16
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#if !defined(DISABLE_OPTIMIZED_SHA256)
|
#if !defined(DISABLE_OPTIMIZED_SHA256)
|
||||||
#include <compat/cpuid.h>
|
#include <compat/cpuid.h> // IWYU pragma: keep
|
||||||
|
|
||||||
#if defined(__linux__) && defined(ENABLE_ARM_SHANI)
|
#if defined(__linux__) && defined(ENABLE_ARM_SHANI)
|
||||||
#include <sys/auxv.h>
|
#include <sys/auxv.h>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <arm_acle.h>
|
|
||||||
#include <arm_neon.h>
|
#include <arm_neon.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
// This is a translation to GCC extended asm syntax from YASM code by Intel
|
// This is a translation to GCC extended asm syntax from YASM code by Intel
|
||||||
// (available at the bottom of this file).
|
// (available at the bottom of this file).
|
||||||
|
|
||||||
|
#if defined(__x86_64__) || defined(__amd64__)
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(__amd64__)
|
|
||||||
|
|
||||||
namespace sha256_sse4
|
namespace sha256_sse4
|
||||||
{
|
{
|
||||||
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
|
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#if defined(ENABLE_SSE41) && defined(ENABLE_X86_SHANI)
|
#if defined(ENABLE_SSE41) && defined(ENABLE_X86_SHANI)
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -9,9 +9,9 @@
|
|||||||
#include <crypto/common.h>
|
#include <crypto/common.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
|
||||||
#include <bit>
|
#include <bit>
|
||||||
#include <cstdint>
|
#include <cassert>
|
||||||
|
#include <iterator>
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
void KeccakF(uint64_t (&st)[25])
|
void KeccakF(uint64_t (&st)[25])
|
||||||
|
|||||||
+1
-2
@@ -5,10 +5,9 @@
|
|||||||
#ifndef BITCOIN_CRYPTO_SHA3_H
|
#ifndef BITCOIN_CRYPTO_SHA3_H
|
||||||
#define BITCOIN_CRYPTO_SHA3_H
|
#define BITCOIN_CRYPTO_SHA3_H
|
||||||
|
|
||||||
#include <span.h>
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
//! The Keccak-f[1600] transform.
|
//! The Keccak-f[1600] transform.
|
||||||
void KeccakF(uint64_t (&st)[25]);
|
void KeccakF(uint64_t (&st)[25]);
|
||||||
|
|||||||
@@ -4,7 +4,11 @@
|
|||||||
|
|
||||||
#include <crypto/siphash.h>
|
#include <crypto/siphash.h>
|
||||||
|
|
||||||
|
#include <uint256.h>
|
||||||
|
|
||||||
#include <bit>
|
#include <bit>
|
||||||
|
#include <cassert>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
#define SIPROUND do { \
|
#define SIPROUND do { \
|
||||||
v0 += v1; v1 = std::rotl(v1, 13); v1 ^= v0; \
|
v0 += v1; v1 = std::rotl(v1, 13); v1 ^= v0; \
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
#define BITCOIN_CRYPTO_SIPHASH_H
|
#define BITCOIN_CRYPTO_SIPHASH_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
#include <span.h>
|
class uint256;
|
||||||
#include <uint256.h>
|
|
||||||
|
|
||||||
/** SipHash-2-4 */
|
/** SipHash-2-4 */
|
||||||
class CSipHasher
|
class CSipHasher
|
||||||
|
|||||||
+17
-3
@@ -2,10 +2,13 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <chainparams.h>
|
|
||||||
#include <common/args.h>
|
|
||||||
#include <index/base.h>
|
#include <index/base.h>
|
||||||
|
|
||||||
|
#include <chain.h>
|
||||||
|
#include <common/args.h>
|
||||||
|
#include <dbwrapper.h>
|
||||||
#include <interfaces/chain.h>
|
#include <interfaces/chain.h>
|
||||||
|
#include <interfaces/types.h>
|
||||||
#include <kernel/chain.h>
|
#include <kernel/chain.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <node/abort.h>
|
#include <node/abort.h>
|
||||||
@@ -13,20 +16,31 @@
|
|||||||
#include <node/context.h>
|
#include <node/context.h>
|
||||||
#include <node/database_args.h>
|
#include <node/database_args.h>
|
||||||
#include <node/interface_ui.h>
|
#include <node/interface_ui.h>
|
||||||
|
#include <primitives/block.h>
|
||||||
|
#include <sync.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
|
#include <uint256.h>
|
||||||
#include <undo.h>
|
#include <undo.h>
|
||||||
|
#include <util/fs.h>
|
||||||
#include <util/string.h>
|
#include <util/string.h>
|
||||||
#include <util/thread.h>
|
#include <util/thread.h>
|
||||||
|
#include <util/threadinterrupt.h>
|
||||||
|
#include <util/time.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
#include <validationinterface.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <cassert>
|
||||||
|
#include <compare>
|
||||||
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
constexpr uint8_t DB_BEST_BLOCK{'B'};
|
constexpr uint8_t DB_BEST_BLOCK{'B'};
|
||||||
|
|
||||||
|
|||||||
+18
-6
@@ -5,29 +5,41 @@
|
|||||||
#ifndef BITCOIN_INDEX_BASE_H
|
#ifndef BITCOIN_INDEX_BASE_H
|
||||||
#define BITCOIN_INDEX_BASE_H
|
#define BITCOIN_INDEX_BASE_H
|
||||||
|
|
||||||
|
#include <attributes.h>
|
||||||
#include <dbwrapper.h>
|
#include <dbwrapper.h>
|
||||||
#include <interfaces/chain.h>
|
#include <interfaces/chain.h>
|
||||||
#include <interfaces/types.h>
|
#include <kernel/cs_main.h>
|
||||||
#include <util/string.h>
|
#include <threadsafety.h>
|
||||||
|
#include <uint256.h>
|
||||||
|
#include <util/fs.h>
|
||||||
#include <util/threadinterrupt.h>
|
#include <util/threadinterrupt.h>
|
||||||
#include <validationinterface.h>
|
#include <validationinterface.h>
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
class CBlock;
|
class CBlock;
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
class Chainstate;
|
class Chainstate;
|
||||||
class ChainstateManager;
|
|
||||||
namespace interfaces {
|
|
||||||
class Chain;
|
|
||||||
} // namespace interfaces
|
|
||||||
|
|
||||||
|
struct CBlockLocator;
|
||||||
struct IndexSummary {
|
struct IndexSummary {
|
||||||
std::string name;
|
std::string name;
|
||||||
bool synced{false};
|
bool synced{false};
|
||||||
int best_block_height{0};
|
int best_block_height{0};
|
||||||
uint256 best_block_hash;
|
uint256 best_block_hash;
|
||||||
};
|
};
|
||||||
|
namespace interfaces {
|
||||||
|
struct BlockRef;
|
||||||
|
}
|
||||||
|
namespace util {
|
||||||
|
template <unsigned int num_params>
|
||||||
|
struct ConstevalFormatString;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for indices of blockchain data. This implements
|
* Base class for indices of blockchain data. This implements
|
||||||
|
|||||||
@@ -2,19 +2,39 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <map>
|
#include <index/blockfilterindex.h>
|
||||||
|
|
||||||
#include <clientversion.h>
|
#include <blockfilter.h>
|
||||||
|
#include <chain.h>
|
||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
#include <dbwrapper.h>
|
#include <dbwrapper.h>
|
||||||
|
#include <flatfile.h>
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
#include <index/blockfilterindex.h>
|
#include <index/base.h>
|
||||||
|
#include <interfaces/chain.h>
|
||||||
|
#include <interfaces/types.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <node/blockstorage.h>
|
#include <serialize.h>
|
||||||
#include <undo.h>
|
#include <streams.h>
|
||||||
#include <util/fs_helpers.h>
|
#include <sync.h>
|
||||||
|
#include <uint256.h>
|
||||||
|
#include <util/check.h>
|
||||||
|
#include <util/fs.h>
|
||||||
|
#include <util/hasher.h>
|
||||||
#include <util/syserror.h>
|
#include <util/syserror.h>
|
||||||
|
|
||||||
|
#include <cerrno>
|
||||||
|
#include <exception>
|
||||||
|
#include <ios>
|
||||||
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
/* The index database stores three items for each block: the disk location of the encoded filter,
|
/* The index database stores three items for each block: the disk location of the encoded filter,
|
||||||
* its dSHA256 hash, and the header. Those belonging to blocks on the active chain are indexed by
|
* its dSHA256 hash, and the header. Those belonging to blocks on the active chain are indexed by
|
||||||
* height, and those belonging to blocks that have been reorganized out of the active chain are
|
* height, and those belonging to blocks that have been reorganized out of the active chain are
|
||||||
|
|||||||
@@ -6,13 +6,24 @@
|
|||||||
#define BITCOIN_INDEX_BLOCKFILTERINDEX_H
|
#define BITCOIN_INDEX_BLOCKFILTERINDEX_H
|
||||||
|
|
||||||
#include <attributes.h>
|
#include <attributes.h>
|
||||||
#include <blockfilter.h>
|
|
||||||
#include <chain.h>
|
|
||||||
#include <flatfile.h>
|
#include <flatfile.h>
|
||||||
#include <index/base.h>
|
#include <index/base.h>
|
||||||
|
#include <interfaces/chain.h>
|
||||||
|
#include <sync.h>
|
||||||
|
#include <uint256.h>
|
||||||
#include <util/hasher.h>
|
#include <util/hasher.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class BlockFilter;
|
||||||
|
class CBlockIndex;
|
||||||
|
enum class BlockFilterType : uint8_t;
|
||||||
|
|
||||||
static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
|
static const char* const DEFAULT_BLOCKFILTERINDEX = "0";
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,39 @@
|
|||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#include <index/coinstatsindex.h>
|
||||||
|
|
||||||
#include <arith_uint256.h>
|
#include <arith_uint256.h>
|
||||||
|
#include <chain.h>
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <coins.h>
|
#include <coins.h>
|
||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
|
#include <consensus/amount.h>
|
||||||
#include <crypto/muhash.h>
|
#include <crypto/muhash.h>
|
||||||
#include <index/coinstatsindex.h>
|
#include <dbwrapper.h>
|
||||||
|
#include <index/base.h>
|
||||||
|
#include <interfaces/chain.h>
|
||||||
|
#include <interfaces/types.h>
|
||||||
#include <kernel/coinstats.h>
|
#include <kernel/coinstats.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <node/blockstorage.h>
|
#include <primitives/block.h>
|
||||||
|
#include <primitives/transaction.h>
|
||||||
|
#include <script/script.h>
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
#include <txdb.h>
|
#include <uint256.h>
|
||||||
#include <undo.h>
|
#include <undo.h>
|
||||||
|
#include <util/check.h>
|
||||||
|
#include <util/fs.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
|
#include <compare>
|
||||||
|
#include <ios>
|
||||||
|
#include <limits>
|
||||||
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using kernel::ApplyCoinHash;
|
using kernel::ApplyCoinHash;
|
||||||
using kernel::CCoinsStats;
|
using kernel::CCoinsStats;
|
||||||
using kernel::GetBogoSize;
|
using kernel::GetBogoSize;
|
||||||
|
|||||||
@@ -6,11 +6,18 @@
|
|||||||
#define BITCOIN_INDEX_COINSTATSINDEX_H
|
#define BITCOIN_INDEX_COINSTATSINDEX_H
|
||||||
|
|
||||||
#include <arith_uint256.h>
|
#include <arith_uint256.h>
|
||||||
|
#include <consensus/amount.h>
|
||||||
#include <crypto/muhash.h>
|
#include <crypto/muhash.h>
|
||||||
#include <index/base.h>
|
#include <index/base.h>
|
||||||
|
#include <interfaces/chain.h>
|
||||||
|
#include <uint256.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
class CDBBatch;
|
|
||||||
namespace kernel {
|
namespace kernel {
|
||||||
struct CCoinsStats;
|
struct CCoinsStats;
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-2
@@ -4,14 +4,32 @@
|
|||||||
|
|
||||||
#include <index/txindex.h>
|
#include <index/txindex.h>
|
||||||
|
|
||||||
#include <clientversion.h>
|
|
||||||
#include <common/args.h>
|
#include <common/args.h>
|
||||||
|
#include <dbwrapper.h>
|
||||||
|
#include <flatfile.h>
|
||||||
|
#include <index/base.h>
|
||||||
#include <index/disktxpos.h>
|
#include <index/disktxpos.h>
|
||||||
|
#include <interfaces/chain.h>
|
||||||
#include <logging.h>
|
#include <logging.h>
|
||||||
#include <node/blockstorage.h>
|
#include <node/blockstorage.h>
|
||||||
#include <primitives/transaction_identifier.h>
|
#include <primitives/block.h>
|
||||||
|
#include <primitives/transaction.h>
|
||||||
|
#include <serialize.h>
|
||||||
|
#include <streams.h>
|
||||||
|
#include <uint256.h>
|
||||||
|
#include <util/fs.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <exception>
|
||||||
|
#include <iterator>
|
||||||
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
constexpr uint8_t DB_TXINDEX{'t'};
|
constexpr uint8_t DB_TXINDEX{'t'};
|
||||||
|
|
||||||
std::unique_ptr<TxIndex> g_txindex;
|
std::unique_ptr<TxIndex> g_txindex;
|
||||||
|
|||||||
@@ -6,6 +6,15 @@
|
|||||||
#define BITCOIN_INDEX_TXINDEX_H
|
#define BITCOIN_INDEX_TXINDEX_H
|
||||||
|
|
||||||
#include <index/base.h>
|
#include <index/base.h>
|
||||||
|
#include <primitives/transaction.h>
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
class uint256;
|
||||||
|
namespace interfaces {
|
||||||
|
class Chain;
|
||||||
|
}
|
||||||
|
|
||||||
static constexpr bool DEFAULT_TXINDEX{false};
|
static constexpr bool DEFAULT_TXINDEX{false};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user