From c72b2c2883d4c8791267133f326e3f9347d1520b Mon Sep 17 00:00:00 2001 From: TheCharlatan Date: Fri, 14 Jun 2024 18:33:08 +0200 Subject: [PATCH] kernel: Add pure kernel bitcoin-chainstate This showcases a re-implementation of bitcoin-chainstate only using the kernel C++ API header. --- .github/workflows/ci.yml | 2 +- ci/test/00_setup_env_win64.sh | 2 +- src/bitcoin-chainstate.cpp | 399 ++++++++++++------------------ test/lint/test_runner/src/main.rs | 1 + 4 files changed, 167 insertions(+), 237 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d15cc04b683f9..e496c44aedf85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,7 +168,7 @@ jobs: job-type: [standard, fuzz] include: - job-type: standard - generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON -DBUILD_KERNEL_LIB=ON' + generate-options: '-DBUILD_GUI=ON -DWITH_BDB=ON -DWITH_ZMQ=ON -DBUILD_BENCH=ON -DWERROR=ON -DBUILD_KERNEL_LIB=ON -DBUILD_UTIL_CHAINSTATE=ON -DBUILD_KERNEL_TEST=OFF' job-name: 'Win64 native, VS 2022' - job-type: fuzz generate-options: '-DVCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON -DVCPKG_MANIFEST_FEATURES="sqlite" -DBUILD_GUI=OFF -DBUILD_FOR_FUZZING=ON -DWERROR=ON' diff --git a/ci/test/00_setup_env_win64.sh b/ci/test/00_setup_env_win64.sh index 39c8e1548e1a9..7a2c6c2593943 100755 --- a/ci/test/00_setup_env_win64.sh +++ b/ci/test/00_setup_env_win64.sh @@ -20,5 +20,5 @@ export GOAL="deploy" # Prior to 11.0.0, the mingw-w64 headers were missing noreturn attributes, causing warnings when # cross-compiling for Windows. https://sourceforge.net/p/mingw-w64/bugs/306/ # https://github.com/mingw-w64/mingw-w64/commit/1690994f515910a31b9fb7c7bd3a52d4ba987abe -export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_GUI_TESTS=OFF -DBUILD_KERNEL_LIB=ON -DBUILD_KERNEL_TEST=ON \ +export BITCOIN_CONFIG="-DREDUCE_EXPORTS=ON -DBUILD_GUI_TESTS=OFF -DBUILD_KERNEL_LIB=ON -DBUILD_KERNEL_TEST=ON -DBUILD_UTIL_CHAINSTATE=ON \ -DCMAKE_CXX_FLAGS='-Wno-error=maybe-uninitialized -Wno-error=array-bounds'" diff --git a/src/bitcoin-chainstate.cpp b/src/bitcoin-chainstate.cpp index e657f01871568..b14ddcb2dcebb 100644 --- a/src/bitcoin-chainstate.cpp +++ b/src/bitcoin-chainstate.cpp @@ -1,273 +1,202 @@ -// Copyright (c) 2022 The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. -// -// 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. -// -// DEVELOPER NOTE: Since this is a "demo-only", experimental, etc. executable, -// it may diverge from Bitcoin Core's coding style. -// -// It is part of the libbitcoinkernel project. - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include