Page MenuHomePhabricator

refactor, txdb: Use DBParams struct in CBlockTreeDB
ClosedPublic

Authored by PiRK on May 2 2024, 08:58.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC1cf4a86ce123: refactor, txdb: Use DBParams struct in CBlockTreeDB
Summary

PR rationale:

Code in the libbitcoin_kernel library should not be calling ArgsManager methods or trying to read options from the command line. Instead it should just get options values from simple structs and function arguments that are passed in externally. This PR removes gArgs accesses from dbwrapper and txdb modules by defining appropriate options structs.

Use DBParams struct to remove ArgsManager uses from txdb.

To reduce size of this commit, this moves references to gArgs variable out of
txdb.cpp to calling code in chainstate.cpp. But these moves are temporary. The
gArgs references in chainstate.cpp are moved out to calling code in init.cpp in
later commits.

This commit does not change behavior.

This is a partial backport of core#25862
https://github.com/bitcoin/bitcoin/pull/25862/commits/0352258148c51572426666d337c7b28d0033376c

Depends on D16092

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.May 2 2024, 08:58
PiRK planned changes to this revision.May 2 2024, 09:17

Tail of the build log:

[573/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/data.cpp.o
[574/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bantablemodel.cpp.o
[575/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/examples.cpp.o
[576/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o
[577/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/hashpadding.cpp.o
[578/624] Building CXX object src/CMakeFiles/bitcoinkernel.dir/validation.cpp.o
[579/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/intro.cpp.o
[580/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/lockedpool.cpp.o
[581/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/block_assemble.cpp.o
[582/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoingui.cpp.o
[583/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/merkle_root.cpp.o
[584/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/nanobench.cpp.o
[585/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/gcs_filter.cpp.o
[586/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/poly1305.cpp.o
[587/624] Linking CXX static library src/libbitcoinkernel.a
[588/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/checkblock.cpp.o
[589/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[590/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[591/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/crypto_aes.cpp.o
[592/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin.cpp.o
[593/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/verify_script.cpp.o
[594/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rollingbloom.cpp.o
[595/624] Linking CXX executable src/bitcoin-chainstate
FAILED: src/bitcoin-chainstate 
: && /usr/bin/c++ -Werror -g -O2 -fuse-ld=gold -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lstdc++fs -fPIE -pie src/CMakeFiles/bitcoin-chainstate.dir/bitcoin-chainstate.cpp.o -o src/bitcoin-chainstate  /usr/lib/x86_64-linux-gnu/libjemalloc_pic.a  -lstdc++fs  src/libbitcoinkernel.a  src/crypto/libcrypto.a  src/crypto/libcrypto_sse4.1.a  src/crypto/libcrypto_avx2.a  src/crypto/libcrypto_shani.a  src/univalue/libunivalue.a  src/secp256k1/libsecp256k1.a  src/leveldb/libleveldb.a  src/leveldb/libleveldb-sse4.2.a  src/leveldb/libmemenv.a  /usr/lib/x86_64-linux-gnu/libjemalloc_pic.a  -lm  -pthread  -ldl  -lstdc++fs && :
../../src/node/chainstate.cpp:33: error: undefined reference to 'node::ReadDatabaseArgs(ArgsManager const&, DBOptions&)'
../../src/validation.cpp:1152: error: undefined reference to 'node::ReadCoinsViewArgs(ArgsManager const&, CoinsViewOptions&)'
../../src/validation.cpp:1147: error: undefined reference to 'node::ReadDatabaseArgs(ArgsManager const&, DBOptions&)'
../../src/index/base.cpp:46: error: undefined reference to 'node::ReadDatabaseArgs(ArgsManager const&, DBOptions&)'
collect2: error: ld returned 1 exit status
[596/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/util_time.cpp.o
[597/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/prevector.cpp.o
[598/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/duplicate_inputs.cpp.o
[599/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/load_external.cpp.o
[600/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/chained_tx.cpp.o
[601/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/bench.cpp.o
[602/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[603/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/platformstyle.cpp.o
[604/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/mempool_eviction.cpp.o
[605/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin.cpp.o
[606/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvaluecombobox.cpp.o
[607/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/peer_eviction.cpp.o
[608/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvalidatedlineedit.cpp.o
[609/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/mempool_stress.cpp.o
[610/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rpc_mempool.cpp.o
[611/624] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rpc_blockchain.cpp.o
[612/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[613/624] Linking CXX executable src/bench/bitcoin-bench
[614/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[615/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[616/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[617/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[618/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
[619/624] Linking CXX static library src/qt/libbitcoin-qt-base.a
[620/624] Automatic MOC for target bitcoin-qt
[621/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[622/624] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[623/624] Linking CXX executable src/qt/bitcoin-qt
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1
This revision is now accepted and ready to land.May 2 2024, 19:38