Page MenuHomePhabricator

Add ChainstateManagerOpts, using as ::Options, pass it an adjusted_time_callback
ClosedPublic

Authored by PiRK on Dec 21 2023, 16:48.

Details

Summary

This reduces coupling validation.cpp from netaddress.cpp (transitively,
timedata.cpp, and asmap.cpp). We unfortunately still have the transitive coupling with these modules because of validation -> avalanche/processor -> net.

This is important for libbitcoinkernel as:

  • There is no reason for the consensus engine to be coupled with netaddress, timedata, and asmap
  • Users of libbitcoinkernel can now easily supply their own std::function that provides the adjusted time.

This is a backport of core#25064

Test Plan

cmake .. -GNinja -DBUILD_BITCOIN_CHAINSTATE=ON && 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.Dec 21 2023, 16:48

Tail of the build log:

   22 |     virtual void SetCashAddrEncoding(bool) = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
../../src/./config.h:23:18: note: 	‘virtual bool Config::UseCashAddrEncoding() const’
   23 |     virtual bool UseCashAddrEncoding() const = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/wallet/init.cpp:11:
../../src/./validation.h: In constructor ‘ChainstateManager::ChainstateManager(const Options&)’:
../../src/./validation.h:1253:73: error: use of deleted function ‘Config::Config(const Config&)’
 1253 |                                      Assert(opts.adjusted_time_callback)} {};
      |                                                                         ^
In file included from ../../src/wallet/init.cpp:7:
../../src/./config.h:26:5: note: declared here
   26 |     Config(const Config &) = delete;
      |     ^~~~~~
[418/543] 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/c++ -DBOOST_ALL_NO_LIB -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../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -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 ../../src/test/util/setup_common.cpp
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/test/util/setup_common.cpp:18:
../../src/./validation.h:1210:18: error: cannot declare field ‘ChainstateManager::m_config’ to be of abstract type ‘Config’
 1210 |     const Config m_config;
      |                  ^~~~~~~~
In file included from ../../src/test/util/setup_common.cpp:10:
../../src/./config.h:17:7: note:   because the following virtual functions are pure within ‘Config’:
   17 | class Config {
      |       ^~~~~~
../../src/./config.h:19:18: note: 	‘virtual bool Config::SetMaxBlockSize(uint64_t)’
   19 |     virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0;
      |                  ^~~~~~~~~~~~~~~
../../src/./config.h:20:22: note: 	‘virtual uint64_t Config::GetMaxBlockSize() const’
   20 |     virtual uint64_t GetMaxBlockSize() const = 0;
      |                      ^~~~~~~~~~~~~~~
../../src/./config.h:21:33: note: 	‘virtual const CChainParams& Config::GetChainParams() const’
   21 |     virtual const CChainParams &GetChainParams() const = 0;
      |                                 ^~~~~~~~~~~~~~
../../src/./config.h:22:18: note: 	‘virtual void Config::SetCashAddrEncoding(bool)’
   22 |     virtual void SetCashAddrEncoding(bool) = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
../../src/./config.h:23:18: note: 	‘virtual bool Config::UseCashAddrEncoding() const’
   23 |     virtual bool UseCashAddrEncoding() const = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/test/util/setup_common.cpp:18:
../../src/./validation.h: In constructor ‘ChainstateManager::ChainstateManager(const Options&)’:
../../src/./validation.h:1253:73: error: use of deleted function ‘Config::Config(const Config&)’
 1253 |                                      Assert(opts.adjusted_time_callback)} {};
      |                                                                         ^
In file included from ../../src/test/util/setup_common.cpp:10:
../../src/./config.h:26:5: note: declared here
   26 |     Config(const Config &) = delete;
      |     ^~~~~~
ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1

Tail of the build log:

                 ^
../../src/./config.h:23:18: note: unimplemented pure virtual method 'UseCashAddrEncoding' in 'Config'
    virtual bool UseCashAddrEncoding() const = 0;
                 ^
1 error generated.
[417/543] 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 -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../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../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 -pthread -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 ../../src/test/util/net.cpp
In file included from ../../src/test/util/net.cpp:5:
In file included from ../../src/./test/util/net.h:9:
In file included from ../../src/./net.h:11:
In file included from ../../src/./avalanche/proofradixtreeadapter.h:8:
In file included from ../../src/./avalanche/proof.h:16:
../../src/./validation.h:1210:18: error: field type 'const Config' is an abstract class
    const Config m_config;
                 ^
../../src/./config.h:19:18: note: unimplemented pure virtual method 'SetMaxBlockSize' in 'Config'
    virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0;
                 ^
../../src/./config.h:20:22: note: unimplemented pure virtual method 'GetMaxBlockSize' in 'Config'
    virtual uint64_t GetMaxBlockSize() const = 0;
                     ^
../../src/./config.h:21:33: note: unimplemented pure virtual method 'GetChainParams' in 'Config'
    virtual const CChainParams &GetChainParams() const = 0;
                                ^
../../src/./config.h:22:18: note: unimplemented pure virtual method 'SetCashAddrEncoding' in 'Config'
    virtual void SetCashAddrEncoding(bool) = 0;
                 ^
../../src/./config.h:23:18: note: unimplemented pure virtual method 'UseCashAddrEncoding' in 'Config'
    virtual bool UseCashAddrEncoding() const = 0;
                 ^
1 error generated.
[418/543] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
FAILED: src/CMakeFiles/server.dir/wallet/init.cpp.o 
/usr/bin/ccache /usr/bin/clang++ -DBOOST_ALL_NO_LIB -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../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../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 -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/wallet/init.cpp.o -MF src/CMakeFiles/server.dir/wallet/init.cpp.o.d -o src/CMakeFiles/server.dir/wallet/init.cpp.o -c ../../src/wallet/init.cpp
In file included from ../../src/wallet/init.cpp:11:
In file included from ../../src/./net.h:11:
In file included from ../../src/./avalanche/proofradixtreeadapter.h:8:
In file included from ../../src/./avalanche/proof.h:16:
../../src/./validation.h:1210:18: error: field type 'const Config' is an abstract class
    const Config m_config;
                 ^
../../src/./config.h:19:18: note: unimplemented pure virtual method 'SetMaxBlockSize' in 'Config'
    virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0;
                 ^
../../src/./config.h:20:22: note: unimplemented pure virtual method 'GetMaxBlockSize' in 'Config'
    virtual uint64_t GetMaxBlockSize() const = 0;
                     ^
../../src/./config.h:21:33: note: unimplemented pure virtual method 'GetChainParams' in 'Config'
    virtual const CChainParams &GetChainParams() const = 0;
                                ^
../../src/./config.h:22:18: note: unimplemented pure virtual method 'SetCashAddrEncoding' in 'Config'
    virtual void SetCashAddrEncoding(bool) = 0;
                 ^
../../src/./config.h:23:18: note: unimplemented pure virtual method 'UseCashAddrEncoding' in 'Config'
    virtual bool UseCashAddrEncoding() const = 0;
                 ^
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:

../../src/./config.h:23:18: note: unimplemented pure virtual method 'UseCashAddrEncoding' in 'Config'
    virtual bool UseCashAddrEncoding() const = 0;
                 ^
3414 warnings and 1 error generated.
Error while processing /work/abc-ci-builds/build-clang-tidy/../../src/wallet/init.cpp.
Suppressed 3414 warnings (3414 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).
[393/541] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[394/541] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[395/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[396/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[397/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[398/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[399/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[400/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[401/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[402/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[403/541] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[404/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[405/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[406/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[407/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[408/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[409/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[410/541] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[411/541] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[412/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[413/541] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[414/541] 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-12;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++" --source=../../src/seeder/bitcoin.cpp -- /usr/bin/clang++ -DBOOST_ALL_NO_LIB -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../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../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 -pthread -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 ../../src/seeder/bitcoin.cpp
../../src/./validation.h:1210:18: error: field type 'const Config' is an abstract class [clang-diagnostic-error]
    const Config m_config;
                 ^
../../src/./config.h:19:18: note: unimplemented pure virtual method 'SetMaxBlockSize' in 'Config'
    virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0;
                 ^
../../src/./config.h:20:22: note: unimplemented pure virtual method 'GetMaxBlockSize' in 'Config'
    virtual uint64_t GetMaxBlockSize() const = 0;
                     ^
../../src/./config.h:21:33: note: unimplemented pure virtual method 'GetChainParams' in 'Config'
    virtual const CChainParams &GetChainParams() const = 0;
                                ^
../../src/./config.h:22:18: note: unimplemented pure virtual method 'SetCashAddrEncoding' in 'Config'
    virtual void SetCashAddrEncoding(bool) = 0;
                 ^
../../src/./config.h:23:18: note: unimplemented pure virtual method 'UseCashAddrEncoding' in 'Config'
    virtual bool UseCashAddrEncoding() const = 0;
                 ^
2905 warnings and 1 error generated.
Error while processing /work/abc-ci-builds/build-clang-tidy/../../src/seeder/bitcoin.cpp.
Suppressed 2905 warnings (2905 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/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[416/541] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[417/541] 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:

      |                  ^~~~~~~~~~~~~~~~~~~
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/test/util/setup_common.cpp:18:
../../src/./validation.h: In constructor ‘ChainstateManager::ChainstateManager(const Options&)’:
../../src/./validation.h:1253:73: error: use of deleted function ‘Config::Config(const Config&)’
 1253 |                                      Assert(opts.adjusted_time_callback)} {};
      |                                                                         ^
In file included from ../../src/test/util/setup_common.cpp:10:
../../src/./config.h:26:5: note: declared here
   26 |     Config(const Config &) = delete;
      |     ^~~~~~
[512/606] 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/c++ -DBOOST_ALL_NO_LIB -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../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -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 ../../src/seeder/bitcoin.cpp
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/./seeder/messagewriter.h:9,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./validation.h:1210:18: error: cannot declare field ‘ChainstateManager::m_config’ to be of abstract type ‘Config’
 1210 |     const Config m_config;
      |                  ^~~~~~~~
In file included from ../../src/./seeder/messagewriter.h:8,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./config.h:17:7: note:   because the following virtual functions are pure within ‘Config’:
   17 | class Config {
      |       ^~~~~~
../../src/./config.h:19:18: note: 	‘virtual bool Config::SetMaxBlockSize(uint64_t)’
   19 |     virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0;
      |                  ^~~~~~~~~~~~~~~
../../src/./config.h:20:22: note: 	‘virtual uint64_t Config::GetMaxBlockSize() const’
   20 |     virtual uint64_t GetMaxBlockSize() const = 0;
      |                      ^~~~~~~~~~~~~~~
../../src/./config.h:21:33: note: 	‘virtual const CChainParams& Config::GetChainParams() const’
   21 |     virtual const CChainParams &GetChainParams() const = 0;
      |                                 ^~~~~~~~~~~~~~
../../src/./config.h:22:18: note: 	‘virtual void Config::SetCashAddrEncoding(bool)’
   22 |     virtual void SetCashAddrEncoding(bool) = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
../../src/./config.h:23:18: note: 	‘virtual bool Config::UseCashAddrEncoding() const’
   23 |     virtual bool UseCashAddrEncoding() const = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/./seeder/messagewriter.h:9,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./validation.h: In constructor ‘ChainstateManager::ChainstateManager(const Options&)’:
../../src/./validation.h:1253:73: error: use of deleted function ‘Config::Config(const Config&)’
 1253 |                                      Assert(opts.adjusted_time_callback)} {};
      |                                                                         ^
In file included from ../../src/./seeder/messagewriter.h:8,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./config.h:26:5: note: declared here
   26 |     Config(const Config &) = delete;
      |     ^~~~~~
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

Tail of the build log:

[405/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[406/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[407/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[408/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[409/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[410/543] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[411/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[412/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[413/543] 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/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_ALL_NO_LIB -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -fcf-protection=full -fstack-clash-protection -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Wredundant-move -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-psabi -pthread -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 ../../src/seeder/bitcoin.cpp
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/./seeder/messagewriter.h:9,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./validation.h:1210:18: error: cannot declare field ‘ChainstateManager::m_config’ to be of abstract type ‘Config’
 1210 |     const Config m_config;
      |                  ^~~~~~~~
In file included from ../../src/./seeder/messagewriter.h:8,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./config.h:17:7: note:   because the following virtual functions are pure within ‘Config’:
   17 | class Config {
      |       ^~~~~~
../../src/./config.h:19:18: note: 	‘virtual bool Config::SetMaxBlockSize(uint64_t)’
   19 |     virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0;
      |                  ^~~~~~~~~~~~~~~
../../src/./config.h:20:22: note: 	‘virtual uint64_t Config::GetMaxBlockSize() const’
   20 |     virtual uint64_t GetMaxBlockSize() const = 0;
      |                      ^~~~~~~~~~~~~~~
../../src/./config.h:21:33: note: 	‘virtual const CChainParams& Config::GetChainParams() const’
   21 |     virtual const CChainParams &GetChainParams() const = 0;
      |                                 ^~~~~~~~~~~~~~
../../src/./config.h:22:18: note: 	‘virtual void Config::SetCashAddrEncoding(bool)’
   22 |     virtual void SetCashAddrEncoding(bool) = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
../../src/./config.h:23:18: note: 	‘virtual bool Config::UseCashAddrEncoding() const’
   23 |     virtual bool UseCashAddrEncoding() const = 0;
      |                  ^~~~~~~~~~~~~~~~~~~
In file included from ../../src/./avalanche/proof.h:16,
                 from ../../src/./avalanche/proofradixtreeadapter.h:8,
                 from ../../src/./net.h:11,
                 from ../../src/./seeder/messagewriter.h:9,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./validation.h: In constructor ‘ChainstateManager::ChainstateManager(const Options&)’:
../../src/./validation.h:1253:73: error: use of deleted function ‘Config::Config(const Config&)’
 1253 |                                      Assert(opts.adjusted_time_callback)} {};
      |                                                                         ^
In file included from ../../src/./seeder/messagewriter.h:8,
                 from ../../src/seeder/bitcoin.cpp:13:
../../src/./config.h:26:5: note: declared here
   26 |     Config(const Config &) = delete;
      |     ^~~~~~
[414/543] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[415/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[416/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[417/543] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[418/543] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1
PiRK planned changes to this revision.Dec 22 2023, 08:19

revert https://github.com/bitcoin/bitcoin/pull/25064/commits/53494bc7392591336e09d095f1fc38d63d566abf
We can't copy the global config. Anyway, as long as it stays a global we don't need to worry about its lifetime.

This revision is now accepted and ready to land.Dec 22 2023, 08:48