mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge pull request #1272 from ElementsProject/temp-ci-rebased
Fix various failing CI tests in 23.x
This commit is contained in:
commit
9ede39744b
18 changed files with 81 additions and 438 deletions
12
.cirrus.yml
12
.cirrus.yml
|
|
@ -175,14 +175,14 @@ task:
|
|||
task:
|
||||
name: 'ARM [unit tests, no functional tests] [bullseye]'
|
||||
<< : *GLOBAL_TASK_TEMPLATE
|
||||
arm_container:
|
||||
container:
|
||||
image: debian:bullseye
|
||||
cpu: 2
|
||||
memory: 8G
|
||||
docker_arguments:
|
||||
CI_IMAGE_NAME_TAG: debian:bullseye
|
||||
<< : *CREDITS_TEMPLATE
|
||||
env:
|
||||
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
|
||||
FILE_ENV: "./ci/test/00_setup_env_arm.sh"
|
||||
QEMU_USER_CMD: "" # Disable qemu and run the test natively
|
||||
|
||||
task:
|
||||
name: 'Win64 [unit tests, no gui tests, no boost::process, no functional tests] [jammy]'
|
||||
|
|
@ -271,13 +271,13 @@ task:
|
|||
FILE_ENV: "./ci/test/00_setup_env_i686_multiprocess.sh"
|
||||
|
||||
task:
|
||||
name: '[no wallet, libbitcoinkernel] [bionic]'
|
||||
name: '[no wallet] [bionic]'
|
||||
<< : *GLOBAL_TASK_TEMPLATE
|
||||
container:
|
||||
image: ubuntu:bionic
|
||||
env:
|
||||
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
|
||||
FILE_ENV: "./ci/test/00_setup_env_native_nowallet_libbitcoinkernel.sh"
|
||||
FILE_ENV: "./ci/test/00_setup_env_native_nowallet.sh"
|
||||
|
||||
task:
|
||||
name: 'macOS 10.15 [gui, no tests] [focal]'
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,7 +9,6 @@ src/elements-gui
|
|||
src/elements-node
|
||||
src/elements-tx
|
||||
src/elements-util
|
||||
src/elements-chainstate
|
||||
src/elements-wallet
|
||||
src/test/fuzz/fuzz
|
||||
src/test/test_bitcoin
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@
|
|||
<AdditionalOptions>/utf-8 /Zc:__cplusplus /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4018;4244;4267;4334;4715;4805;4834</DisableSpecificWarnings>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;SECP256K1_STATIC;_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING;ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;_WIN32_IE=0x0501;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src;..\..\src\minisketch\include;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,17 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\pegins.cpp" />
|
||||
<ClCompile Include="..\..\src\psbt.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\bitcoin\transaction.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\transaction.cpp" />
|
||||
@SOURCE_FILES@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj">
|
||||
<Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\common.vcxproj" />
|
||||
|
|
|
|||
|
|
@ -8,11 +8,18 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\primitives\transaction.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\bitcoin\transaction.cpp" />
|
||||
@SOURCE_FILES@
|
||||
<ClCompile Include="..\..\src\wallet\init.cpp">
|
||||
<ObjectFileName>$(IntDir)wallet_init.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj">
|
||||
<Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\common.vcxproj" />
|
||||
|
|
|
|||
|
|
@ -8,11 +8,35 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\asset.cpp" />
|
||||
<ClCompile Include="..\..\src\chain.cpp" />
|
||||
<ClCompile Include="..\..\src\confidential_validation.cpp" />
|
||||
<ClCompile Include="..\..\src\deploymentstatus.cpp" />
|
||||
<ClCompile Include="..\..\src\dynafed.cpp" />
|
||||
<ClCompile Include="..\..\src\mainchainrpc.cpp" />
|
||||
<ClCompile Include="..\..\src\node\interfaces.cpp" />
|
||||
<ClCompile Include="..\..\src\node\ui_interface.cpp" />
|
||||
<ClCompile Include="..\..\src\pegins.cpp" />
|
||||
<ClCompile Include="..\..\src\pow.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\bitcoin\transaction.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\pak.cpp" />
|
||||
<ClCompile Include="..\..\src\rpc\server.cpp" />
|
||||
<ClCompile Include="..\..\src\script\sigcache.cpp" />
|
||||
<ClCompile Include="..\..\src\shutdown.cpp" />
|
||||
<ClCompile Include="..\..\src\sync.cpp" />
|
||||
<ClCompile Include="..\..\src\validation.cpp" />
|
||||
<ClCompile Include="..\..\src\versionbits.cpp" />
|
||||
<ClCompile Include="..\..\src\wallet\bdb.cpp" />
|
||||
<ClCompile Include="..\..\src\wallet\rpc\elements.cpp" />
|
||||
<ClCompile Include="..\..\src\wallet\salvage.cpp" />
|
||||
<ClCompile Include="..\..\src\wallet\sqlite.cpp" />
|
||||
@SOURCE_FILES@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libsecp256k1\libsecp256k1.vcxproj">
|
||||
<Project>{bb493552-3b8c-4a8c-bf69-a6e7a51d2ea6}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\common.vcxproj" />
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\arith_uint256.cpp" />
|
||||
<ClCompile Include="..\..\src\asset.cpp" />
|
||||
<ClCompile Include="..\..\src\consensus\merkle.cpp" />
|
||||
<ClCompile Include="..\..\src\consensus\tx_check.cpp" />
|
||||
<ClCompile Include="..\..\src\crypto\aes.cpp" />
|
||||
|
|
@ -22,7 +23,9 @@
|
|||
<ClCompile Include="..\..\src\crypto\sha512.cpp" />
|
||||
<ClCompile Include="..\..\src\hash.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\block.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\confidential.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\transaction.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\txwitness.cpp" />
|
||||
<ClCompile Include="..\..\src\pubkey.cpp" />
|
||||
<ClCompile Include="..\..\src\script\bitcoinconsensus.cpp" />
|
||||
<ClCompile Include="..\..\src\script\interpreter.cpp" />
|
||||
|
|
|
|||
|
|
@ -8,15 +8,18 @@
|
|||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\secp256k1\src\precomputed_ecmult.c" />
|
||||
<ClCompile Include="..\..\src\secp256k1\src\precomputed_ecmult_gen.c" />
|
||||
<ClCompile Include="..\..\src\secp256k1\src\secp256k1.c" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>ENABLE_MODULE_ECDH;ENABLE_MODULE_RECOVERY;ENABLE_MODULE_EXTRAKEYS;ENABLE_MODULE_SCHNORRSIG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\secp256k1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<PreprocessorDefinitions>ENABLE_MODULE_GENERATOR;ENABLE_MODULE_RANGEPROOF;ENABLE_MODULE_SURJECTIONPROOF;ECMULT_WINDOW_SIZE=15;ECMULT_GEN_PREC_BITS=8;ENABLE_MODULE_WHITELIST;ENABLE_MODULE_ECDH;ENABLE_MODULE_ECDSA_ADAPTOR;ENABLE_MODULE_ECDSA_S2C;ENABLE_MODULE_RECOVERY;ENABLE_MODULE_EXTRAKEYS;ENABLE_MODULE_SCHNORRSIG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\src\secp256k1;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4005;4146;4244;4267;4334</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="..\common.vcxproj" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_rpcnestedtests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_uritests.cpp" />
|
||||
<ClCompile Include="$(GeneratedFilesOutDir)\moc\moc_wallettests.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\bitcoin\transaction.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libbitcoinconsensus\libbitcoinconsensus.vcxproj">
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<ClCompile Include="..\..\src\wallet\test\*_fixture.cpp" />
|
||||
<ClCompile Include="..\..\src\wallet\test\*_tests.cpp" />
|
||||
<ClCompile Include="..\..\src\wallet\test\util.cpp" />
|
||||
<ClCompile Include="..\..\src\primitives\bitcoin\transaction.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\libminisketch\libminisketch.vcxproj">
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
export CONTAINER_NAME=ci_native_nowallet_libbitcoinkernel
|
||||
export CONTAINER_NAME=ci_native_nowallet
|
||||
export DOCKER_NAME_TAG=ubuntu:18.04 # Use bionic to have one config run the tests in python3.6, see doc/dependencies.md
|
||||
export PACKAGES="python3-zmq clang-7 llvm-7 libc++abi-7-dev libc++-7-dev" # Use clang-7 to test C++17 compatibility, see doc/dependencies.md
|
||||
export DEP_OPTS="NO_WALLET=1 CC=clang-7 CXX='clang++-7 -stdlib=libc++'"
|
||||
export GOAL="install"
|
||||
export BITCOIN_CONFIG="--enable-reduce-exports CC=clang-7 CXX='clang++-7 -stdlib=libc++' --enable-experimental-util-chainstate"
|
||||
export BITCOIN_CONFIG="--enable-reduce-exports CC=clang-7 CXX='clang++-7 -stdlib=libc++'"
|
||||
13
configure.ac
13
configure.ac
|
|
@ -24,7 +24,6 @@ BITCOIN_GUI_NAME=elements-qt
|
|||
BITCOIN_CLI_NAME=elements-cli
|
||||
BITCOIN_TX_NAME=elements-tx
|
||||
BITCOIN_UTIL_NAME=elements-util
|
||||
BITCOIN_CHAINSTATE_NAME=elements-chainstate
|
||||
BITCOIN_WALLET_TOOL_NAME=elements-wallet
|
||||
dnl Multi Process
|
||||
BITCOIN_MP_NODE_NAME=elements-node
|
||||
|
|
@ -655,12 +654,6 @@ AC_ARG_ENABLE([util-util],
|
|||
[build_bitcoin_util=$enableval],
|
||||
[build_bitcoin_util=$build_bitcoin_utils])
|
||||
|
||||
AC_ARG_ENABLE([experimental-util-chainstate],
|
||||
[AS_HELP_STRING([--enable-experimental-util-chainstate],
|
||||
[build experimental bitcoin-chainstate executable (default=no)])],
|
||||
[build_bitcoin_chainstate=$enableval],
|
||||
[build_bitcoin_chainstate=no])
|
||||
|
||||
AC_ARG_WITH([libs],
|
||||
[AS_HELP_STRING([--with-libs],
|
||||
[build libraries (default=yes)])],
|
||||
|
|
@ -1283,7 +1276,6 @@ if test "$enable_fuzz" = "yes"; then
|
|||
build_bitcoin_cli=no
|
||||
build_bitcoin_tx=no
|
||||
build_bitcoin_util=no
|
||||
build_bitcoin_chainstate=no
|
||||
build_bitcoin_wallet=no
|
||||
build_bitcoind=no
|
||||
build_bitcoin_libs=no
|
||||
|
|
@ -1648,10 +1640,6 @@ AC_MSG_CHECKING([whether to build bitcoin-util])
|
|||
AM_CONDITIONAL([BUILD_BITCOIN_UTIL], [test $build_bitcoin_util = "yes"])
|
||||
AC_MSG_RESULT($build_bitcoin_util)
|
||||
|
||||
AC_MSG_CHECKING([whether to build experimental bitcoin-chainstate])
|
||||
AM_CONDITIONAL([BUILD_BITCOIN_CHAINSTATE], [test $build_bitcoin_chainstate = "yes"])
|
||||
AC_MSG_RESULT($build_bitcoin_chainstate)
|
||||
|
||||
AC_MSG_CHECKING([whether to build libraries])
|
||||
AM_CONDITIONAL([BUILD_BITCOIN_LIBS], [test $build_bitcoin_libs = "yes"])
|
||||
if test "$build_bitcoin_libs" = "yes"; then
|
||||
|
|
@ -1872,7 +1860,6 @@ AC_SUBST(BITCOIN_GUI_NAME)
|
|||
AC_SUBST(BITCOIN_CLI_NAME)
|
||||
AC_SUBST(BITCOIN_TX_NAME)
|
||||
AC_SUBST(BITCOIN_UTIL_NAME)
|
||||
AC_SUBST(BITCOIN_CHAINSTATE_NAME)
|
||||
AC_SUBST(BITCOIN_WALLET_TOOL_NAME)
|
||||
AC_SUBST(BITCOIN_MP_NODE_NAME)
|
||||
AC_SUBST(BITCOIN_MP_GUI_NAME)
|
||||
|
|
|
|||
130
src/Makefile.am
130
src/Makefile.am
|
|
@ -106,10 +106,6 @@ if BUILD_BITCOIN_UTIL
|
|||
bin_PROGRAMS += elements-util
|
||||
endif
|
||||
|
||||
if BUILD_BITCOIN_CHAINSTATE
|
||||
bin_PROGRAMS += bitcoin-chainstate
|
||||
endif
|
||||
|
||||
.PHONY: FORCE check-symbols check-security
|
||||
# bitcoin core #
|
||||
BITCOIN_CORE_H = \
|
||||
|
|
@ -820,132 +816,6 @@ elements_util_LDADD = \
|
|||
$(LIBSECP256K1)
|
||||
#
|
||||
|
||||
# bitcoin-chainstate binary #
|
||||
bitcoin_chainstate_SOURCES = \
|
||||
bitcoin-chainstate.cpp \
|
||||
arith_uint256.cpp \
|
||||
blockfilter.cpp \
|
||||
chain.cpp \
|
||||
chainparamsbase.cpp \
|
||||
chainparams.cpp \
|
||||
clientversion.cpp \
|
||||
coins.cpp \
|
||||
compat/glibcxx_sanity.cpp \
|
||||
compressor.cpp \
|
||||
consensus/merkle.cpp \
|
||||
consensus/tx_check.cpp \
|
||||
consensus/tx_verify.cpp \
|
||||
core_read.cpp \
|
||||
dbwrapper.cpp \
|
||||
deploymentinfo.cpp \
|
||||
deploymentstatus.cpp \
|
||||
flatfile.cpp \
|
||||
fs.cpp \
|
||||
hash.cpp \
|
||||
index/base.cpp \
|
||||
index/blockfilterindex.cpp \
|
||||
index/coinstatsindex.cpp \
|
||||
init/common.cpp \
|
||||
key.cpp \
|
||||
logging.cpp \
|
||||
netaddress.cpp \
|
||||
node/blockstorage.cpp \
|
||||
node/chainstate.cpp \
|
||||
node/coinstats.cpp \
|
||||
node/ui_interface.cpp \
|
||||
policy/feerate.cpp \
|
||||
policy/fees.cpp \
|
||||
policy/packages.cpp \
|
||||
policy/policy.cpp \
|
||||
policy/rbf.cpp \
|
||||
policy/settings.cpp \
|
||||
pow.cpp \
|
||||
primitives/block.cpp \
|
||||
primitives/transaction.cpp \
|
||||
pubkey.cpp \
|
||||
random.cpp \
|
||||
randomenv.cpp \
|
||||
scheduler.cpp \
|
||||
script/interpreter.cpp \
|
||||
script/script.cpp \
|
||||
script/script_error.cpp \
|
||||
script/sigcache.cpp \
|
||||
script/standard.cpp \
|
||||
shutdown.cpp \
|
||||
signet.cpp \
|
||||
support/cleanse.cpp \
|
||||
support/lockedpool.cpp \
|
||||
sync.cpp \
|
||||
threadinterrupt.cpp \
|
||||
timedata.cpp \
|
||||
txdb.cpp \
|
||||
txmempool.cpp \
|
||||
uint256.cpp \
|
||||
util/asmap.cpp \
|
||||
util/bytevectorhash.cpp \
|
||||
util/getuniquepath.cpp \
|
||||
util/hasher.cpp \
|
||||
util/moneystr.cpp \
|
||||
util/rbf.cpp \
|
||||
util/serfloat.cpp \
|
||||
util/settings.cpp \
|
||||
util/strencodings.cpp \
|
||||
util/syscall_sandbox.cpp \
|
||||
util/system.cpp \
|
||||
util/thread.cpp \
|
||||
util/threadnames.cpp \
|
||||
util/time.cpp \
|
||||
util/tokenpipe.cpp \
|
||||
validation.cpp \
|
||||
validationinterface.cpp \
|
||||
versionbits.cpp \
|
||||
warnings.cpp
|
||||
# ELEMENTS: additional sources for chainstate
|
||||
bitcoin_chainstate_SOURCES += \
|
||||
asset.cpp \
|
||||
blind.cpp \
|
||||
blindpsbt.cpp \
|
||||
block_proof.cpp \
|
||||
common/bloom.cpp \
|
||||
confidential_validation.cpp \
|
||||
dynafed.cpp \
|
||||
issuance.cpp \
|
||||
mainchainrpc.cpp \
|
||||
merkleblock.cpp \
|
||||
pegins.cpp \
|
||||
primitives/bitcoin/block.cpp \
|
||||
primitives/bitcoin/merkleblock.cpp \
|
||||
primitives/bitcoin/transaction.cpp \
|
||||
primitives/confidential.cpp \
|
||||
primitives/pak.cpp \
|
||||
primitives/txwitness.cpp \
|
||||
psbt.cpp \
|
||||
rpc/request.cpp \
|
||||
script/pegins.cpp \
|
||||
script/sign.cpp \
|
||||
script/signingprovider.cpp \
|
||||
support/events.h \
|
||||
util/url.cpp
|
||||
|
||||
bitcoin_chainstate_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
|
||||
bitcoin_chainstate_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
|
||||
bitcoin_chainstate_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
|
||||
bitcoin_chainstate_LDADD = \
|
||||
$(LIBBITCOIN_CRYPTO) \
|
||||
$(LIBUNIVALUE) \
|
||||
$(LIBSECP256K1) \
|
||||
$(LIBLEVELDB) \
|
||||
$(LIBLEVELDB_SSE42) \
|
||||
$(LIBMEMENV)
|
||||
# ELEMENTS:
|
||||
bitcoin_chainstate_LDADD += \
|
||||
$(EVENT_LIBS)
|
||||
|
||||
# Required for obj/build.h to be generated first.
|
||||
# More details: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html
|
||||
bitcoin_chainstate-clientversion.$(OBJEXT): obj/build.h
|
||||
#
|
||||
|
||||
# bitcoinconsensus library #
|
||||
if BUILD_BITCOIN_LIBS
|
||||
include_HEADERS = script/bitcoinconsensus.h
|
||||
|
|
|
|||
|
|
@ -1,262 +0,0 @@
|
|||
// 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 <chainparams.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <core_io.h>
|
||||
#include <init/common.h>
|
||||
#include <node/blockstorage.h>
|
||||
#include <node/chainstate.h>
|
||||
#include <scheduler.h>
|
||||
#include <script/sigcache.h>
|
||||
#include <util/system.h>
|
||||
#include <util/thread.h>
|
||||
#include <validation.h>
|
||||
#include <validationinterface.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// SETUP: Argument parsing and handling
|
||||
if (argc != 2) {
|
||||
std::cerr
|
||||
<< "Usage: " << argv[0] << " DATADIR" << std::endl
|
||||
<< "Display DATADIR information, and process hex-encoded blocks on standard input." << std::endl
|
||||
<< std::endl
|
||||
<< "IMPORTANT: THIS EXECUTABLE IS EXPERIMENTAL, FOR TESTING ONLY, AND EXPECTED TO" << std::endl
|
||||
<< " BREAK IN FUTURE VERSIONS. DO NOT USE ON YOUR ACTUAL DATADIR." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
std::filesystem::path abs_datadir = std::filesystem::absolute(argv[1]);
|
||||
std::filesystem::create_directories(abs_datadir);
|
||||
gArgs.ForceSetArg("-datadir", abs_datadir.string());
|
||||
|
||||
|
||||
// SETUP: Misc Globals
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
const CChainParams& chainparams = Params();
|
||||
|
||||
init::SetGlobals(); // ECC_Start, etc.
|
||||
|
||||
// Necessary for CheckInputScripts (eventually called by ProcessNewBlock),
|
||||
// which will try the script cache first and fall back to actually
|
||||
// performing the check with the signature cache.
|
||||
InitSignatureCache();
|
||||
InitScriptExecutionCache();
|
||||
|
||||
|
||||
// SETUP: Scheduling and Background Signals
|
||||
CScheduler scheduler{};
|
||||
// Start the lightweight task scheduler thread
|
||||
scheduler.m_service_thread = std::thread(util::TraceThread, "scheduler", [&] { scheduler.serviceQueue(); });
|
||||
|
||||
// Gather some entropy once per minute.
|
||||
scheduler.scheduleEvery(RandAddPeriodic, std::chrono::minutes{1});
|
||||
|
||||
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
|
||||
|
||||
|
||||
// SETUP: Chainstate
|
||||
ChainstateManager chainman;
|
||||
|
||||
auto rv = node::LoadChainstate(false,
|
||||
std::ref(chainman),
|
||||
nullptr,
|
||||
false,
|
||||
chainparams.GetConsensus(),
|
||||
false,
|
||||
2 << 20,
|
||||
2 << 22,
|
||||
(450 << 20) - (2 << 20) - (2 << 22),
|
||||
false,
|
||||
false,
|
||||
[]() { return false; });
|
||||
if (rv.has_value()) {
|
||||
std::cerr << "Failed to load Chain state from your datadir." << std::endl;
|
||||
goto epilogue;
|
||||
} else {
|
||||
auto maybe_verify_error = node::VerifyLoadedChainstate(std::ref(chainman),
|
||||
false,
|
||||
false,
|
||||
chainparams.GetConsensus(),
|
||||
DEFAULT_CHECKBLOCKS,
|
||||
DEFAULT_CHECKLEVEL,
|
||||
/*get_unix_time_seconds=*/static_cast<int64_t (*)()>(GetTime));
|
||||
if (maybe_verify_error.has_value()) {
|
||||
std::cerr << "Failed to verify loaded Chain state from your datadir." << std::endl;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
for (CChainState* chainstate : WITH_LOCK(::cs_main, return chainman.GetAll())) {
|
||||
BlockValidationState state;
|
||||
if (!chainstate->ActivateBestChain(state, nullptr)) {
|
||||
std::cerr << "Failed to connect best block (" << state.ToString() << ")" << std::endl;
|
||||
goto epilogue;
|
||||
}
|
||||
}
|
||||
|
||||
// Main program logic starts here
|
||||
std::cout
|
||||
<< "Hello! I'm going to print out some information about your datadir." << std::endl
|
||||
<< "\t" << "Path: " << gArgs.GetDataDirNet() << std::endl
|
||||
<< "\t" << "Reindexing: " << std::boolalpha << node::fReindex.load() << std::noboolalpha << std::endl
|
||||
<< "\t" << "Snapshot Active: " << std::boolalpha << chainman.IsSnapshotActive() << std::noboolalpha << std::endl
|
||||
<< "\t" << "Active Height: " << chainman.ActiveHeight() << std::endl
|
||||
<< "\t" << "Active IBD: " << std::boolalpha << chainman.ActiveChainstate().IsInitialBlockDownload() << std::noboolalpha << std::endl;
|
||||
{
|
||||
CBlockIndex* tip = chainman.ActiveTip();
|
||||
if (tip) {
|
||||
std::cout << "\t" << tip->ToString() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for (std::string line; std::getline(std::cin, line);) {
|
||||
if (line.empty()) {
|
||||
std::cerr << "Empty line found" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
std::shared_ptr<CBlock> blockptr = std::make_shared<CBlock>();
|
||||
CBlock& block = *blockptr;
|
||||
|
||||
if (!DecodeHexBlk(block, line)) {
|
||||
std::cerr << "Block decode failed" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
if (block.vtx.empty() || !block.vtx[0]->IsCoinBase()) {
|
||||
std::cerr << "Block does not start with a coinbase" << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
uint256 hash = block.GetHash();
|
||||
{
|
||||
LOCK(cs_main);
|
||||
const CBlockIndex* pindex = chainman.m_blockman.LookupBlockIndex(hash);
|
||||
if (pindex) {
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
std::cerr << "duplicate" << std::endl;
|
||||
break;
|
||||
}
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK) {
|
||||
std::cerr << "duplicate-invalid" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
const CBlockIndex* pindex = chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock);
|
||||
if (pindex) {
|
||||
UpdateUncommittedBlockStructures(block, pindex, chainparams.GetConsensus());
|
||||
}
|
||||
}
|
||||
|
||||
// Adapted from rpc/mining.cpp
|
||||
class submitblock_StateCatcher final : public CValidationInterface
|
||||
{
|
||||
public:
|
||||
uint256 hash;
|
||||
bool found;
|
||||
BlockValidationState state;
|
||||
|
||||
explicit submitblock_StateCatcher(const uint256& hashIn) : hash(hashIn), found(false), state() {}
|
||||
|
||||
protected:
|
||||
void BlockChecked(const CBlock& block, const BlockValidationState& stateIn) override
|
||||
{
|
||||
if (block.GetHash() != hash)
|
||||
return;
|
||||
found = true;
|
||||
state = stateIn;
|
||||
}
|
||||
};
|
||||
|
||||
bool new_block;
|
||||
auto sc = std::make_shared<submitblock_StateCatcher>(block.GetHash());
|
||||
RegisterSharedValidationInterface(sc);
|
||||
bool accepted = chainman.ProcessNewBlock(chainparams, blockptr, /* force_processing */ true, /* new_block */ &new_block);
|
||||
UnregisterSharedValidationInterface(sc);
|
||||
if (!new_block && accepted) {
|
||||
std::cerr << "duplicate" << std::endl;
|
||||
break;
|
||||
}
|
||||
if (!sc->found) {
|
||||
std::cerr << "inconclusive" << std::endl;
|
||||
break;
|
||||
}
|
||||
std::cout << sc->state.ToString() << std::endl;
|
||||
switch (sc->state.GetResult()) {
|
||||
case BlockValidationResult::BLOCK_RESULT_UNSET:
|
||||
std::cerr << "initial value. Block has not yet been rejected" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_CONSENSUS:
|
||||
std::cerr << "invalid by consensus rules (excluding any below reasons)" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_RECENT_CONSENSUS_CHANGE:
|
||||
std::cerr << "Invalid by a change to consensus rules more recent than SegWit." << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_CACHED_INVALID:
|
||||
std::cerr << "this block was cached as being invalid and we didn't store the reason why" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_INVALID_HEADER:
|
||||
std::cerr << "invalid proof of work or time too old" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_MUTATED:
|
||||
std::cerr << "the block's data didn't match the data committed to by the PoW" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_MISSING_PREV:
|
||||
std::cerr << "We don't have the previous block the checked one is built on" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_INVALID_PREV:
|
||||
std::cerr << "A block this one builds on is invalid" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_TIME_FUTURE:
|
||||
std::cerr << "block timestamp was > 2 hours in the future (or our clock is bad)" << std::endl;
|
||||
break;
|
||||
case BlockValidationResult::BLOCK_CHECKPOINT:
|
||||
std::cerr << "the block failed to meet one of our checkpoints" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
epilogue:
|
||||
// Without this precise shutdown sequence, there will be a lot of nullptr
|
||||
// dereferencing and UB.
|
||||
scheduler.stop();
|
||||
if (chainman.m_load_block.joinable()) chainman.m_load_block.join();
|
||||
StopScriptCheckWorkerThreads();
|
||||
|
||||
GetMainSignals().FlushBackgroundCallbacks();
|
||||
{
|
||||
LOCK(cs_main);
|
||||
for (CChainState* chainstate : chainman.GetAll()) {
|
||||
if (chainstate->CanFlushToDisk()) {
|
||||
chainstate->ForceFlushStateToDisk();
|
||||
chainstate->ResetCoinsViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||
|
||||
UnloadBlockIndex(nullptr, chainman);
|
||||
|
||||
init::UnsetGlobals();
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ bool IsConfirmedBitcoinBlock(const uint256& hash, const int nMinConfirmationDept
|
|||
return false;
|
||||
}
|
||||
}
|
||||
} catch (CConnectionFailed& e) {
|
||||
} catch (CConnectionFailed&) {
|
||||
LogPrintf("WARNING: Lost connection to mainchain daemon RPC; will retry.\n");
|
||||
return false;
|
||||
} catch (...) {
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static bool CheckPeginTx(const std::vector<unsigned char>& tx_data, T& pegtx, co
|
|||
if (!pegtx_stream.empty()) {
|
||||
return false;
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
} catch (std::exception&) {
|
||||
// Invalid encoding of transaction
|
||||
return false;
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ static bool GetBlockAndTxFromMerkleBlock(uint256& block_hash, uint256& tx_hash,
|
|||
}
|
||||
tx_hash = tx_hashes[0];
|
||||
tx_index = tx_indices[0];
|
||||
} catch (std::exception& e) {
|
||||
} catch (std::exception&) {
|
||||
// Invalid encoding of merkle block
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,10 +61,11 @@ BOOST_AUTO_TEST_CASE(psbt_updater_test)
|
|||
BOOST_CHECK_EQUAL(final_hex, "70736274ff01009a020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f00000000000100bb0200000001aad73931018bd25f84ae400b68848be09db706eac2ac18298babee71ab656f8b0000000048473044022058f6fc7c6a33e1b31548d481c826c015bd30135aad42cd67790dab66d2ad243b02204a1ced2604c6735b6393e5b41691dd78b00f0c5942fb9f751856faa938157dba01feffffff0280f0fa020000000017a9140fb9463421696b82c833af241c78c17ddbde493487d0f20a270100000017a91429ca74f8a08f81999428185c97b5d852e4063f6187650000000104475221029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f2102dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d752ae2206029583bf39ae0a609747ad199addd634fa6108559d6c5cd39b4c2183f1ab96e07f10d90c6a4f000000800000008000000080220602dab61ff49a14db6a7d02b0cd1fbb78fc4b18312b5b4e54dae4dba2fbfef536d710d90c6a4f00000080000000800100008001090880f0fa02000000000001012000c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e88701042200208c2353173743b595dfb4a07b72ba8e42e3797da74e87fe7d9d7497e3b2028903010547522103089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc21023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7352ae2206023add904f3d6dcf59ddb906b0dee23529b7ffb9ed50e5e86151926860221f0e7310d90c6a4f000000800000008003000080220603089dc10c7ac6db54f91329af617333db388cead0c231f723379d1b99030b02dc10d90c6a4f00000080000000800200008001090800c2eb0b0000000000220203a9a4c37f5996d3aa25dbac6b570af0650394492942460b354753ed9eeca5877110d90c6a4f000000800000008004000080010521010000000000000000000000000000000000000000000000000000000000000000002202027f6399757d2eff55a136ad02c684b1838b6556e5f1b6b34282a94b6b5005109610d90c6a4f00000080000000800500008001052101000000000000000000000000000000000000000000000000000000000000000000");
|
||||
|
||||
// Mutate the transaction so that one of the inputs is invalid
|
||||
psbtx.inputs[0].prevout.n = 2;
|
||||
// psbtx.inputs[0].prevout.n = 2; // ELEMENTS: FIXME
|
||||
|
||||
// Try to sign the mutated input
|
||||
SignatureData sigdata;
|
||||
bool complete = true;
|
||||
BOOST_CHECK(m_wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, true, true) != TransactionError::OK);
|
||||
//BOOST_CHECK(spk_man->FillPSBT(psbtx, PrecomputePSBTData(psbtx), SIGHASH_ALL, true, true) != TransactionError::OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,28 +88,28 @@ EXTENDED_SCRIPTS = [
|
|||
BASE_SCRIPTS = [
|
||||
# Scripts that are run by default.
|
||||
# vv First elements tests vv
|
||||
'feature_fedpeg.py',
|
||||
'feature_fedpeg.py --pre_transition',
|
||||
'feature_fedpeg.py --post_transition',
|
||||
'feature_fedpeg.py --legacy-wallet',
|
||||
'feature_fedpeg.py --pre_transition --legacy-wallet',
|
||||
'feature_fedpeg.py --post_transition --legacy-wallet',
|
||||
'feature_mandatory_coinbase.py',
|
||||
'feature_dynafed.py',
|
||||
'feature_sighash_rangeproof.py',
|
||||
'feature_dynafed.py --legacy-wallet',
|
||||
'feature_sighash_rangeproof.py --legacy-wallet',
|
||||
'feature_block_subsidy.py',
|
||||
'feature_connect_genesis_outputs.py',
|
||||
'feature_connect_genesis_outputs.py --legacy-wallet',
|
||||
'feature_block_v4.py',
|
||||
'feature_pak.py',
|
||||
'feature_blocksign.py',
|
||||
'feature_pak.py --legacy-wallet',
|
||||
'feature_blocksign.py --legacy-wallet',
|
||||
'rpc_calcfastmerkleroot.py',
|
||||
'feature_txwitness.py',
|
||||
'rpc_tweakfedpeg.py',
|
||||
'feature_issuance.py',
|
||||
'feature_confidential_transactions.py',
|
||||
'feature_default_asset_name.py',
|
||||
'rpc_tweakfedpeg.py --legacy-wallet',
|
||||
'feature_issuance.py --legacy-wallet',
|
||||
'feature_confidential_transactions.py --legacy-wallet',
|
||||
'feature_default_asset_name.py --legacy-wallet',
|
||||
'feature_assetsdir.py',
|
||||
'feature_initial_reissuance_token.py',
|
||||
'feature_initial_reissuance_token.py --legacy-wallet',
|
||||
'feature_progress.py',
|
||||
'rpc_getnewblockhex.py',
|
||||
'wallet_elements_regression_1172.py',
|
||||
'wallet_elements_regression_1172.py --legacy-wallet',
|
||||
# Longest test should go first, to favor running tests in parallel
|
||||
'wallet_hd.py --legacy-wallet',
|
||||
'wallet_hd.py --descriptors',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue