Page MenuHomePhabricator

Fix initialization of setBlockIndexCandidates when working with multiple chainstates
ClosedPublic

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

Details

Summary

When using assumeutxo and multiple chainstates are active, the background
chainstate should consider all HAVE_DATA blocks that are ancestors of the
snapshotted block and that have more work than the tip as potential candidates.

This is a partial backport of core27746
https://github.com/bitcoin/bitcoin/pull/27746/commits/768690b7ce551cd403f8e2a099372915f6022ad4

Depends on D17534

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:54
PiRK planned changes to this revision.Wed, Jan 15, 11:10

Tail of the build log:

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.
[419/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.
[420/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[421/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[422/579] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[423/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[424/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[425/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[426/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[427/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[428/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[429/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[430/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[431/579] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[432/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[433/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[434/579] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[435/579] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[436/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[437/579] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[438/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.
[439/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[440/579] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[441/579] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[442/579] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[443/579] Linking CXX executable src/iguana/iguana
[444/579] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[445/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[446/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[447/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[448/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[449/579] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[450/579] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

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).
[414/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[415/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
FAILED: src/test/CMakeFiles/testutil.dir/util/validation.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/validation.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/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
/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/test/util/validation.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).
[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/transaction.cpp.o
[425/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.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/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).
[433/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[434/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[435/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[436/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[437/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[438/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[439/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.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-tool.dir/wallettool.cpp.o
[445/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.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
This revision is now accepted and ready to land.Wed, Jan 15, 21:55