Skip to content

Commit 095aa6c

Browse files
committed
build: Add example bitcoin-chainstate executable
The bitcoin-chainstate executable serves to surface the dependencies required by a program wishing to use Bitcoin Core's consensus engine as it is right now. More broadly, the _SOURCES list serves as a guiding "North Star" for the libbitcoinkernel project: as we decouple more and more modules of the codebase from our consensus engine, this _SOURCES list will grow shorter and shorter. One day, only what is critical to our consensus engine will remain. Right now, it's "the minimal list of files to link in to even use our consensus engine". [META] In a future commit the libbitcoinkernel library will be extracted from bitcoin-chainstate, and the libbitcoinkernel library's _SOURCES list will be the list that we aim to shrink.
1 parent 3ce40e6 commit 095aa6c

File tree

4 files changed

+372
-0
lines changed

4 files changed

+372
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ src/bitcoin-gui
99
src/bitcoin-node
1010
src/bitcoin-tx
1111
src/bitcoin-util
12+
src/bitcoin-chainstate
1213
src/bitcoin-wallet
1314
src/test/fuzz/fuzz
1415
src/test/test_bitcoin

configure.ac

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ BITCOIN_GUI_NAME=bitcoin-qt
2424
BITCOIN_CLI_NAME=bitcoin-cli
2525
BITCOIN_TX_NAME=bitcoin-tx
2626
BITCOIN_UTIL_NAME=bitcoin-util
27+
BITCOIN_CHAINSTATE_NAME=bitcoin-chainstate
2728
BITCOIN_WALLET_TOOL_NAME=bitcoin-wallet
2829
dnl Multi Process
2930
BITCOIN_MP_NODE_NAME=bitcoin-node
@@ -626,6 +627,12 @@ AC_ARG_ENABLE([util-util],
626627
[build_bitcoin_util=$enableval],
627628
[build_bitcoin_util=$build_bitcoin_utils])
628629

630+
AC_ARG_ENABLE([experimental-util-chainstate],
631+
[AS_HELP_STRING([--enable-experimental-util-chainstate],
632+
[build experimental bitcoin-chainstate executable (default=no)])],
633+
[build_bitcoin_chainstate=$enableval],
634+
[build_bitcoin_chainstate=no])
635+
629636
AC_ARG_WITH([libs],
630637
[AS_HELP_STRING([--with-libs],
631638
[build libraries (default=yes)])],
@@ -1249,6 +1256,7 @@ if test "$enable_fuzz" = "yes"; then
12491256
build_bitcoin_cli=no
12501257
build_bitcoin_tx=no
12511258
build_bitcoin_util=no
1259+
build_bitcoin_chainstate=no
12521260
build_bitcoin_wallet=no
12531261
build_bitcoind=no
12541262
build_bitcoin_libs=no
@@ -1589,6 +1597,10 @@ AC_MSG_CHECKING([whether to build bitcoin-util])
15891597
AM_CONDITIONAL([BUILD_BITCOIN_UTIL], [test $build_bitcoin_util = "yes"])
15901598
AC_MSG_RESULT($build_bitcoin_util)
15911599

1600+
AC_MSG_CHECKING([whether to build experimental bitcoin-chainstate])
1601+
AM_CONDITIONAL([BUILD_BITCOIN_CHAINSTATE], [test $build_bitcoin_chainstate = "yes"])
1602+
AC_MSG_RESULT($build_bitcoin_chainstate)
1603+
15921604
AC_MSG_CHECKING([whether to build libraries])
15931605
AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test $build_bitcoin_libs = "yes"])
15941606
if test "$build_bitcoin_libs" = "yes"; then
@@ -1807,6 +1819,7 @@ AC_SUBST(BITCOIN_GUI_NAME)
18071819
AC_SUBST(BITCOIN_CLI_NAME)
18081820
AC_SUBST(BITCOIN_TX_NAME)
18091821
AC_SUBST(BITCOIN_UTIL_NAME)
1822+
AC_SUBST(BITCOIN_CHAINSTATE_NAME)
18101823
AC_SUBST(BITCOIN_WALLET_TOOL_NAME)
18111824
AC_SUBST(BITCOIN_MP_NODE_NAME)
18121825
AC_SUBST(BITCOIN_MP_GUI_NAME)

src/Makefile.am

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ if BUILD_BITCOIN_UTIL
102102
bin_PROGRAMS += bitcoin-util
103103
endif
104104

105+
if BUILD_BITCOIN_CHAINSTATE
106+
bin_PROGRAMS += bitcoin-chainstate
107+
endif
108+
105109
.PHONY: FORCE check-symbols check-security
106110
# bitcoin core #
107111
BITCOIN_CORE_H = \
@@ -759,6 +763,98 @@ bitcoin_util_LDADD = \
759763
$(LIBSECP256K1)
760764
#
761765

766+
# bitcoin-chainstate binary #
767+
bitcoin_chainstate_SOURCES = \
768+
bitcoin-chainstate.cpp \
769+
arith_uint256.cpp \
770+
blockfilter.cpp \
771+
chain.cpp \
772+
chainparamsbase.cpp \
773+
chainparams.cpp \
774+
clientversion.cpp \
775+
coins.cpp \
776+
compat/glibcxx_sanity.cpp \
777+
compressor.cpp \
778+
consensus/merkle.cpp \
779+
consensus/tx_check.cpp \
780+
consensus/tx_verify.cpp \
781+
core_read.cpp \
782+
dbwrapper.cpp \
783+
deploymentinfo.cpp \
784+
deploymentstatus.cpp \
785+
flatfile.cpp \
786+
fs.cpp \
787+
hash.cpp \
788+
index/base.cpp \
789+
index/blockfilterindex.cpp \
790+
index/coinstatsindex.cpp \
791+
init/common.cpp \
792+
key.cpp \
793+
logging.cpp \
794+
netaddress.cpp \
795+
node/blockstorage.cpp \
796+
node/chainstate.cpp \
797+
node/coinstats.cpp \
798+
node/ui_interface.cpp \
799+
policy/feerate.cpp \
800+
policy/fees.cpp \
801+
policy/packages.cpp \
802+
policy/policy.cpp \
803+
policy/rbf.cpp \
804+
policy/settings.cpp \
805+
pow.cpp \
806+
primitives/block.cpp \
807+
primitives/transaction.cpp \
808+
pubkey.cpp \
809+
random.cpp \
810+
randomenv.cpp \
811+
scheduler.cpp \
812+
script/interpreter.cpp \
813+
script/script.cpp \
814+
script/script_error.cpp \
815+
script/sigcache.cpp \
816+
script/standard.cpp \
817+
shutdown.cpp \
818+
signet.cpp \
819+
support/cleanse.cpp \
820+
support/lockedpool.cpp \
821+
sync.cpp \
822+
threadinterrupt.cpp \
823+
timedata.cpp \
824+
txdb.cpp \
825+
txmempool.cpp \
826+
uint256.cpp \
827+
util/asmap.cpp \
828+
util/bytevectorhash.cpp \
829+
util/getuniquepath.cpp \
830+
util/hasher.cpp \
831+
util/moneystr.cpp \
832+
util/rbf.cpp \
833+
util/serfloat.cpp \
834+
util/settings.cpp \
835+
util/strencodings.cpp \
836+
util/syscall_sandbox.cpp \
837+
util/system.cpp \
838+
util/thread.cpp \
839+
util/threadnames.cpp \
840+
util/time.cpp \
841+
util/tokenpipe.cpp \
842+
validation.cpp \
843+
validationinterface.cpp \
844+
versionbits.cpp \
845+
warnings.cpp
846+
bitcoin_chainstate_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
847+
bitcoin_chainstate_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
848+
bitcoin_chainstate_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
849+
bitcoin_chainstate_LDADD = \
850+
$(LIBBITCOIN_CRYPTO) \
851+
$(LIBUNIVALUE) \
852+
$(LIBSECP256K1) \
853+
$(LIBLEVELDB) \
854+
$(LIBLEVELDB_SSE42) \
855+
$(LIBMEMENV)
856+
#
857+
762858
# bitcoinconsensus library #
763859
if BUILD_BITCOIN_LIBS
764860
include_HEADERS = script/bitcoinconsensus.h

0 commit comments

Comments
 (0)