Page MenuHomePhabricator

Move block-storage-related logic to ChainstateManager
ClosedPublic

Authored by PiRK on Wed, Jan 15, 10:51.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC2edc904cea06: Move block-storage-related logic to ChainstateManager
Summary

Separate the notion of which blocks are stored on disk, and what data is in our
block index, from what tip a chainstate might be able to get to. We can use
chainstate-agnostic data to determine when to store a block on disk (primarily,
an anti-DoS set of criteria) and let the chainstates figure out for themselves
when a block is of interest for being a candidate tip.

Note: some of the invariants in CheckBlockIndex are modified, but more work is
needed (ie to move CheckBlockIndex to ChainstateManager, as most of what
CheckBlockIndex is doing is checking the consistency of the block index, which
is outside of Chainstate).

This is a partial backport of core#27746
https://github.com/bitcoin/bitcoin/pull/27746/commits/d0d40ea9a6478d81d7531b7cfc52a8bdaa0883d6

Depends on D17532

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Wed, Jan 15, 10:51

Tail of the build log:

        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[446/579] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
FAILED: src/test/CMakeFiles/testutil.dir/util/mining.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/CMakeFiles/testutil.dir/util/mining.cpp.o -MF src/test/CMakeFiles/testutil.dir/util/mining.cpp.o.d -o src/test/CMakeFiles/testutil.dir/util/mining.cpp.o -c /work/src/test/util/mining.cpp
In file included from /work/src/test/util/mining.cpp:12:
In file included from /work/src/./net.h:11:
In file included from /work/src/./avalanche/proofradixtreeadapter.h:8:
In file included from /work/src/./avalanche/proof.h:16:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[447/579] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
FAILED: src/test/CMakeFiles/testutil.dir/util/net.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/CMakeFiles/testutil.dir/util/net.cpp.o -MF src/test/CMakeFiles/testutil.dir/util/net.cpp.o.d -o src/test/CMakeFiles/testutil.dir/util/net.cpp.o -c /work/src/test/util/net.cpp
In file included from /work/src/test/util/net.cpp:5:
In file included from /work/src/./test/util/net.h:9:
In file included from /work/src/./net.h:11:
In file included from /work/src/./avalanche/proofradixtreeadapter.h:8:
In file included from /work/src/./avalanche/proof.h:16:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[448/579] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
FAILED: src/test/CMakeFiles/testutil.dir/util/validation.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/CMakeFiles/testutil.dir/util/validation.cpp.o -MF src/test/CMakeFiles/testutil.dir/util/validation.cpp.o.d -o src/test/CMakeFiles/testutil.dir/util/validation.cpp.o -c /work/src/test/util/validation.cpp
In file included from /work/src/test/util/validation.cpp:5:
In file included from /work/src/./test/util/validation.h:8:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[449/579] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
FAILED: src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o -MF src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o.d -o src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o -c /work/src/seeder/bitcoin.cpp
In file included from /work/src/seeder/bitcoin.cpp:11:
In file included from /work/src/./net_processing.h:10:
In file included from /work/src/./net.h:11:
In file included from /work/src/./avalanche/proofradixtreeadapter.h:8:
In file included from /work/src/./avalanche/proof.h:16:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[450/579] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
FAILED: src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o -MF src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o.d -o src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o -c /work/src/test/util/setup_common.cpp
In file included from /work/src/test/util/setup_common.cpp:23:
In file included from /work/src/./net.h:11:
In file included from /work/src/./avalanche/proofradixtreeadapter.h:8:
In file included from /work/src/./avalanche/proof.h:16:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

Suppressed 2098 warnings (2098 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
[415/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
FAILED: src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o 
/usr/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy-16;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" --source=/work/src/test/util/setup_common.cpp -- /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang-tidy/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang-tidy/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o -MF src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o.d -o src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o -c /work/src/test/util/setup_common.cpp
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex' [clang-diagnostic-error]
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
2137 warnings and 1 error generated.
Error while processing /work/src/test/util/setup_common.cpp.
Suppressed 2137 warnings (2137 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
[416/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[417/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[418/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[419/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[420/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[421/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[422/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[423/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[424/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[425/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[426/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[427/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[428/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[429/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[430/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[431/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[432/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[433/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[434/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
FAILED: src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o 
/usr/bin/cmake -E __run_co_compile --launcher=/usr/bin/ccache --tidy="/usr/bin/clang-tidy-16;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" --source=/work/src/seeder/bitcoin.cpp -- /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-clang-tidy/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-clang-tidy/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -g -O2 -fPIC -fvisibility=hidden -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o -MF src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o.d -o src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o -c /work/src/seeder/bitcoin.cpp
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex' [clang-diagnostic-error]
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
2098 warnings and 1 error generated.
Error while processing /work/src/seeder/bitcoin.cpp.
Suppressed 2098 warnings (2098 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
[435/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[436/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[437/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[438/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[439/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[440/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[441/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[442/577] Linking CXX executable src/iguana/iguana
[443/577] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[444/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[445/577] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[446/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[447/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[448/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[449/577] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1

Tail of the build log:

        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[396/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[397/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[398/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[399/422] Building CXX object src/test/fuzz/CMakeFiles/fuzz.dir/txrequest.cpp.o
FAILED: src/test/fuzz/CMakeFiles/fuzz.dir/txrequest.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-fuzzer/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-fuzzer/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIE -fvisibility=hidden -fsanitize=fuzzer -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/fuzz/CMakeFiles/fuzz.dir/txrequest.cpp.o -MF src/test/fuzz/CMakeFiles/fuzz.dir/txrequest.cpp.o.d -o src/test/fuzz/CMakeFiles/fuzz.dir/txrequest.cpp.o -c /work/src/test/fuzz/txrequest.cpp
In file included from /work/src/test/fuzz/txrequest.cpp:8:
In file included from /work/src/./invrequest.h:8:
In file included from /work/src/./net.h:11:
In file included from /work/src/./avalanche/proofradixtreeadapter.h:8:
In file included from /work/src/./avalanche/proof.h:16:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[400/422] Building CXX object src/test/fuzz/CMakeFiles/fuzz.dir/util.cpp.o
FAILED: src/test/fuzz/CMakeFiles/fuzz.dir/util.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-fuzzer/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-fuzzer/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIE -fvisibility=hidden -fsanitize=fuzzer -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/fuzz/CMakeFiles/fuzz.dir/util.cpp.o -MF src/test/fuzz/CMakeFiles/fuzz.dir/util.cpp.o.d -o src/test/fuzz/CMakeFiles/fuzz.dir/util.cpp.o -c /work/src/test/fuzz/util.cpp
In file included from /work/src/test/fuzz/util.cpp:5:
In file included from /work/src/./test/fuzz/util.h:12:
In file included from /work/src/./net.h:11:
In file included from /work/src/./avalanche/proofradixtreeadapter.h:8:
In file included from /work/src/./avalanche/proof.h:16:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[401/422] Building CXX object src/test/fuzz/CMakeFiles/fuzz.dir/validation_load_mempool.cpp.o
FAILED: src/test/fuzz/CMakeFiles/fuzz.dir/validation_load_mempool.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -DBOOST_NO_CXX98_FUNCTION_BASE -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I/work/src/. -I/work/abc-ci-builds/build-fuzzer/src -I/work/src/univalue/include -I/work/abc-ci-builds/build-fuzzer/src/crypto/.. -I/work/src/secp256k1/include -I/work/src/leveldb/include -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIE -fvisibility=hidden -fsanitize=fuzzer -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wgnu -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wthread-safety -Wrange-loop-analysis -Wredundant-decls -Wunreachable-code-loop-increment -Wsign-compare -Wconditional-uninitialized -Wdocumentation -Wformat-security -Wredundant-move -Woverloaded-virtual -Wshadow -Wshadow-field -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -std=gnu++17 -MD -MT src/test/fuzz/CMakeFiles/fuzz.dir/validation_load_mempool.cpp.o -MF src/test/fuzz/CMakeFiles/fuzz.dir/validation_load_mempool.cpp.o.d -o src/test/fuzz/CMakeFiles/fuzz.dir/validation_load_mempool.cpp.o -c /work/src/test/fuzz/validation_load_mempool.cpp
In file included from /work/src/test/fuzz/validation_load_mempool.cpp:12:
In file included from /work/src/./test/fuzz/mempool_utils.h:8:
/work/src/./validation.h:1449:35: error: use of undeclared identifier 'cs_avalancheFinalizedBlockIndex'
        EXCLUSIVE_LOCKS_REQUIRED(!cs_avalancheFinalizedBlockIndex);
                                  ^
1 error generated.
[402/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[403/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[404/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[405/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[406/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[407/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[408/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[409/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[410/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[411/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[412/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[413/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[414/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[415/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[416/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[417/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[418/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[419/422] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[420/422] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-fuzzer failed with exit code 1
PiRK planned changes to this revision.Wed, Jan 15, 11:10

lock issue detected by clang

remove wrong negative lock annotation

Fabien requested changes to this revision.Wed, Jan 15, 21:45
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/validation.cpp
4792 ↗(On Diff #52218)

This is confusing, just like the GetConfig below because these are also global getters. Since it's now a ChainstateManager method you can just access the private member.

This revision now requires changes to proceed.Wed, Jan 15, 21:45
This revision is now accepted and ready to land.Thu, Jan 16, 19:55