aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--.gitignore2
-rw-r--r--CONTRIBUTING.md3
-rw-r--r--Makefile.am10
-rw-r--r--build_msvc/libbitcoin_consensus/libbitcoin_consensus.vcxproj1
-rwxr-xr-xci/lint/04_install.sh2
-rwxr-xr-xci/test/00_setup_env_i686_multiprocess.sh2
-rwxr-xr-xci/test/00_setup_env_native_asan.sh6
-rwxr-xr-xci/test/00_setup_env_native_fuzz.sh6
-rwxr-xr-xci/test/00_setup_env_native_previous_releases.sh2
-rwxr-xr-xci/test/00_setup_env_native_tidy.sh2
-rwxr-xr-xci/test/00_setup_env_native_tsan.sh4
-rw-r--r--configure.ac26
-rwxr-xr-xcontrib/guix/libexec/build.sh26
-rw-r--r--contrib/guix/manifest.scm5
-rw-r--r--contrib/guix/patches/glibc-2.27-fcommon.patch2
-rw-r--r--depends/hosts/darwin.mk2
-rw-r--r--depends/hosts/linux.mk2
-rw-r--r--depends/hosts/mingw32.mk2
-rw-r--r--depends/packages/expat.mk2
-rw-r--r--depends/packages/libmultiprocess.mk2
-rw-r--r--depends/packages/qt.mk10
-rw-r--r--depends/packages/sqlite.mk1
-rw-r--r--depends/patches/qt/fix_android_jni_static.patch1
-rw-r--r--depends/patches/qt/memory_resource.patch2
-rw-r--r--depends/patches/qt/use_android_ndk23.patch13
-rw-r--r--doc/README.md1
-rw-r--r--doc/build-unix.md4
-rw-r--r--doc/dependencies.md2
-rw-r--r--doc/design/libraries.md9
-rw-r--r--doc/dnsseed-policy.md2
-rw-r--r--doc/release-notes/release-notes-26.1.md106
-rw-r--r--doc/shared-libraries.md78
-rw-r--r--libbitcoinconsensus.pc.in10
-rw-r--r--src/Makefile.am19
-rw-r--r--src/Makefile.test.include1
-rw-r--r--src/bench/verify_script.cpp18
-rw-r--r--src/bitcoin-cli.cpp5
-rw-r--r--src/cuckoocache.h2
-rw-r--r--src/logging.cpp190
-rw-r--r--src/logging.h9
-rw-r--r--src/script/bitcoinconsensus.cpp157
-rw-r--r--src/script/bitcoinconsensus.h96
-rw-r--r--src/script/miniscript.h2
-rw-r--r--src/test/fuzz/script_bitcoin_consensus.cpp50
-rw-r--r--src/test/script_tests.cpp228
-rw-r--r--src/validation.cpp2
-rw-r--r--src/validation.h4
-rwxr-xr-xtest/functional/feature_assumevalid.py2
-rwxr-xr-xtest/functional/p2p_block_sync.py2
-rwxr-xr-xtest/functional/p2p_compactblocks.py2
-rwxr-xr-xtest/functional/p2p_node_network_limited.py5
-rwxr-xr-xtest/functional/p2p_segwit.py8
-rwxr-xr-xtest/functional/test_framework/p2p.py30
54 files changed, 257 insertions, 925 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4b2f4f2913..b92e3c66d0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -62,7 +62,7 @@ jobs:
echo "TEST_BASE=$(git rev-list -n$((${{ env.MAX_COUNT }} + 1)) --reverse HEAD ^$(git rev-list -n1 --merges HEAD)^@ | head -1)" >> "$GITHUB_ENV"
- run: |
sudo apt-get update
- sudo apt-get install clang-15 ccache build-essential libtool autotools-dev automake pkg-config bsdmainutils python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libminiupnpc-dev libnatpmp-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y
+ sudo apt-get install clang-15 ccache build-essential libtool autotools-dev automake pkg-config bsdmainutils python3-zmq libevent-dev libboost-dev libsqlite3-dev libdb++-dev systemtap-sdt-dev libminiupnpc-dev libnatpmp-dev qtbase5-dev qttools5-dev qttools5-dev-tools qtwayland5 libqrencode-dev -y
- name: Compile and run tests
run: |
# Run tests on commits after the last merge commit and before the PR head commit
diff --git a/.gitignore b/.gitignore
index 3fe36aba89..f7bcbd1459 100644
--- a/.gitignore
+++ b/.gitignore
@@ -136,7 +136,6 @@ test/lint/test_runner/target/
/doc/doxygen/
-libbitcoinconsensus.pc
contrib/devtools/split-debug.sh
# Output from running db4 installation
@@ -145,7 +144,6 @@ db4/
# clang-check
*.plist
-osx_volname
dist/
/guix-build-*
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 0ae4ff1a92..0ac6db76ed 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -66,9 +66,10 @@ Discussion about codebase improvements happens in GitHub issues and pull
requests.
The developer
-[mailing list](https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev)
+[mailing list](https://groups.google.com/g/bitcoindev)
should be used to discuss complicated or controversial consensus or P2P protocol changes before working on
a patch set.
+Archives can be found on [https://gnusha.org/pi/bitcoindev/](https://gnusha.org/pi/bitcoindev/).
Contributor Workflow
diff --git a/Makefile.am b/Makefile.am
index 5ea690dec8..cd1509a0ff 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,11 +14,6 @@ endif
.PHONY: deploy FORCE
.INTERMEDIATE: $(COVERAGE_INFO)
-if BUILD_BITCOIN_LIBS
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libbitcoinconsensus.pc
-endif
-
BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT)
BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT)
BITCOIN_TEST_BIN=$(top_builddir)/src/test/$(BITCOIN_TEST_NAME)$(EXEEXT)
@@ -118,9 +113,6 @@ OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lp
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
-osx_volname:
- echo $(OSX_VOLNAME) >$@
-
if BUILD_DARWIN
$(OSX_ZIP): $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -zip
@@ -338,7 +330,7 @@ clean-docs:
clean-local: clean-docs
rm -rf coverage_percent.txt test_bitcoin.coverage/ total.coverage/ fuzz.coverage/ test/tmp/ cache/ $(OSX_APP)
rm -rf test/functional/__pycache__ test/functional/test_framework/__pycache__ test/cache share/rpcauth/__pycache__
- rm -rf osx_volname dist/ test/lint/test_runner/target/ test/lint/__pycache__
+ rm -rf dist/ test/lint/test_runner/target/ test/lint/__pycache__
test-security-check:
if TARGET_DARWIN
diff --git a/build_msvc/libbitcoin_consensus/libbitcoin_consensus.vcxproj b/build_msvc/libbitcoin_consensus/libbitcoin_consensus.vcxproj
index 95fdcdb79b..a34ef41d16 100644
--- a/build_msvc/libbitcoin_consensus/libbitcoin_consensus.vcxproj
+++ b/build_msvc/libbitcoin_consensus/libbitcoin_consensus.vcxproj
@@ -15,7 +15,6 @@
<ClCompile Include="..\..\src\primitives\block.cpp" />
<ClCompile Include="..\..\src\primitives\transaction.cpp" />
<ClCompile Include="..\..\src\pubkey.cpp" />
- <ClCompile Include="..\..\src\script\bitcoinconsensus.cpp" />
<ClCompile Include="..\..\src\script\interpreter.cpp" />
<ClCompile Include="..\..\src\script\script.cpp" />
<ClCompile Include="..\..\src\script\script_error.cpp" />
diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh
index 47cb8864c2..6b12c53f2a 100755
--- a/ci/lint/04_install.sh
+++ b/ci/lint/04_install.sh
@@ -46,7 +46,7 @@ if [ ! -d "${LINT_RUNNER_PATH}" ]; then
fi
${CI_RETRY_EXE} pip3 install \
- codespell==2.2.5 \
+ codespell==2.2.6 \
flake8==6.1.0 \
lief==0.13.2 \
mypy==1.4.1 \
diff --git a/ci/test/00_setup_env_i686_multiprocess.sh b/ci/test/00_setup_env_i686_multiprocess.sh
index a5f3682c36..00a4d781c2 100755
--- a/ci/test/00_setup_env_i686_multiprocess.sh
+++ b/ci/test/00_setup_env_i686_multiprocess.sh
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
export HOST=i686-pc-linux-gnu
export CONTAINER_NAME=ci_i686_multiprocess
-export CI_IMAGE_NAME_TAG="docker.io/amd64/ubuntu:22.04"
+export CI_IMAGE_NAME_TAG="docker.io/amd64/ubuntu:24.04"
export PACKAGES="llvm clang g++-multilib"
export DEP_OPTS="DEBUG=1 MULTIPROCESS=1"
export GOAL="install"
diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh
index 840daf9708..911b4726ec 100755
--- a/ci/test/00_setup_env_native_asan.sh
+++ b/ci/test/00_setup_env_native_asan.sh
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
# Only install BCC tracing packages in Cirrus CI.
if [[ "${CIRRUS_CI}" == "true" ]]; then
- BPFCC_PACKAGE="bpfcc-tools linux-headers-$(uname --kernel-release)"
+ BPFCC_PACKAGE="" # Temporarily disabled "bpfcc-tools linux-headers-$(uname --kernel-release)"
export CI_CONTAINER_CAP="--privileged -v /sys/kernel:/sys/kernel:rw"
else
BPFCC_PACKAGE=""
@@ -17,10 +17,10 @@ else
fi
export CONTAINER_NAME=ci_native_asan
-export PACKAGES="systemtap-sdt-dev clang-17 llvm-17 libclang-rt-17-dev python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE}"
+export PACKAGES="systemtap-sdt-dev clang-18 llvm-18 libclang-rt-18-dev python3-zmq qtbase5-dev qttools5-dev-tools libevent-dev libboost-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE}"
export NO_DEPENDS=1
export GOAL="install"
export BITCOIN_CONFIG="--enable-usdt --enable-zmq --with-incompatible-bdb --with-gui=qt5 \
CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER' \
--with-sanitizers=address,float-divide-by-zero,integer,undefined \
-CC='clang-17 -ftrivial-auto-var-init=pattern' CXX='clang++-17 -ftrivial-auto-var-init=pattern'"
+CC='clang-18 -ftrivial-auto-var-init=pattern' CXX='clang++-18 -ftrivial-auto-var-init=pattern'"
diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh
index abee3c1541..f50561f875 100755
--- a/ci/test/00_setup_env_native_fuzz.sh
+++ b/ci/test/00_setup_env_native_fuzz.sh
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
export CONTAINER_NAME=ci_native_fuzz
-export PACKAGES="clang-17 llvm-17 libclang-rt-17-dev libevent-dev libboost-dev libsqlite3-dev"
+export PACKAGES="clang-18 llvm-18 libclang-rt-18-dev libevent-dev libboost-dev libsqlite3-dev"
export NO_DEPENDS=1
export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
@@ -16,6 +16,6 @@ export RUN_FUZZ_TESTS=true
export GOAL="install"
export CI_CONTAINER_CAP="--cap-add SYS_PTRACE" # If run with (ASan + LSan), the container needs access to ptrace (https://github.com/google/sanitizers/issues/764)
export BITCOIN_CONFIG="--enable-fuzz --with-sanitizers=fuzzer,address,undefined,float-divide-by-zero,integer \
-CC='clang-17 -ftrivial-auto-var-init=pattern' CXX='clang++-17 -ftrivial-auto-var-init=pattern'"
+CC='clang-18 -ftrivial-auto-var-init=pattern' CXX='clang++-18 -ftrivial-auto-var-init=pattern'"
export CCACHE_MAXSIZE=200M
-export LLVM_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-17"
+export LLVM_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-18"
diff --git a/ci/test/00_setup_env_native_previous_releases.sh b/ci/test/00_setup_env_native_previous_releases.sh
index 3166686d9a..9da3b18999 100755
--- a/ci/test/00_setup_env_native_previous_releases.sh
+++ b/ci/test/00_setup_env_native_previous_releases.sh
@@ -16,5 +16,5 @@ export RUN_UNIT_TESTS_SEQUENTIAL="true"
export RUN_UNIT_TESTS="false"
export GOAL="install"
export DOWNLOAD_PREVIOUS_RELEASES="true"
-export BITCOIN_CONFIG="--enable-zmq --with-libs=no --with-gui=qt5 --enable-reduce-exports --enable-debug \
+export BITCOIN_CONFIG="--enable-zmq --with-gui=qt5 --enable-reduce-exports --enable-debug \
CFLAGS=\"-g0 -O2 -funsigned-char\" CPPFLAGS='-DBOOST_MULTI_INDEX_ENABLE_SAFE_MODE' CXXFLAGS=\"-g0 -O2 -funsigned-char\""
diff --git a/ci/test/00_setup_env_native_tidy.sh b/ci/test/00_setup_env_native_tidy.sh
index a5ba64da15..4c8658479b 100755
--- a/ci/test/00_setup_env_native_tidy.sh
+++ b/ci/test/00_setup_env_native_tidy.sh
@@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
export CONTAINER_NAME=ci_native_tidy
export TIDY_LLVM_V="18"
-export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq bear libevent-dev libboost-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev systemtap-sdt-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev"
+export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq bear libevent-dev libboost-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev systemtap-sdt-dev qtbase5-dev qttools5-dev qttools5-dev-tools libqrencode-dev libsqlite3-dev libdb++-dev"
export NO_DEPENDS=1
export RUN_UNIT_TESTS=false
export RUN_FUNCTIONAL_TESTS=false
diff --git a/ci/test/00_setup_env_native_tsan.sh b/ci/test/00_setup_env_native_tsan.sh
index aa23bad809..23ab1ae000 100755
--- a/ci/test/00_setup_env_native_tsan.sh
+++ b/ci/test/00_setup_env_native_tsan.sh
@@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8
export CONTAINER_NAME=ci_native_tsan
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
-export PACKAGES="clang-17 llvm-17 libclang-rt-17-dev libc++abi-17-dev libc++-17-dev python3-zmq"
-export DEP_OPTS="CC=clang-17 CXX='clang++-17 -stdlib=libc++'"
+export PACKAGES="clang-18 llvm-18 libclang-rt-18-dev libc++abi-18-dev libc++-18-dev python3-zmq"
+export DEP_OPTS="CC=clang-18 CXX='clang++-18 -stdlib=libc++'"
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION' CXXFLAGS='-g' --with-sanitizers=thread"
diff --git a/configure.ac b/configure.ac
index 03b5ff1d69..964b7d0942 100644
--- a/configure.ac
+++ b/configure.ac
@@ -626,15 +626,9 @@ AC_ARG_ENABLE([experimental-util-chainstate],
[build_bitcoin_chainstate=$enableval],
[build_bitcoin_chainstate=no])
-AC_ARG_WITH([libs],
- [AS_HELP_STRING([--with-libs],
- [build libraries (default=yes)])],
- [build_bitcoin_libs=$withval],
- [build_bitcoin_libs=yes])
-
AC_ARG_WITH([experimental-kernel-lib],
[AS_HELP_STRING([--with-experimental-kernel-lib],
- [build experimental bitcoinkernel library (default is to build if we're building libraries and the experimental build-chainstate executable)])],
+ [build experimental bitcoinkernel library (default is to build if we're building the experimental build-chainstate executable)])],
[build_experimental_kernel_lib=$withval],
[build_experimental_kernel_lib=auto])
@@ -1262,7 +1256,6 @@ if test "$enable_fuzz" = "yes"; then
build_bitcoin_chainstate=no
build_bitcoin_wallet=no
build_bitcoind=no
- build_bitcoin_libs=no
bitcoin_enable_qt=no
bitcoin_enable_qt_test=no
bitcoin_enable_qt_dbus=no
@@ -1421,7 +1414,7 @@ if test "$use_boost" = "yes"; then
dnl Check for Boost headers
AX_BOOST_BASE([1.73.0],[],[AC_MSG_ERROR([Boost is not available!])])
if test "$want_boost" = "no"; then
- AC_MSG_ERROR([only libbitcoinconsensus can be built without Boost])
+ AC_MSG_ERROR([Boost is required])
fi
dnl we don't use multi_index serialization
@@ -1635,18 +1628,8 @@ fi
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
- AC_DEFINE([HAVE_CONSENSUS_LIB], [1], [Define this symbol if the consensus lib has been built])
- AC_CONFIG_FILES([libbitcoinconsensus.pc:libbitcoinconsensus.pc.in])
-fi
-
AM_CONDITIONAL([BUILD_BITCOIN_KERNEL_LIB], [test "$build_experimental_kernel_lib" != "no" && ( test "$build_experimental_kernel_lib" = "yes" || test "$build_bitcoin_chainstate" = "yes" )])
-AC_MSG_RESULT($build_bitcoin_libs)
-
AC_LANG_POP
if test "$use_ccache" != "no"; then
@@ -1780,8 +1763,8 @@ else
AC_MSG_RESULT([no])
fi
-if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_util$build_bitcoin_libs$build_bitcoind$bitcoin_enable_qt$enable_fuzz_binary$use_bench$use_tests" = "nononononononononono"; then
- AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-fuzz(-binary) --enable-bench or --enable-tests])
+if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_util$build_bitcoind$bitcoin_enable_qt$enable_fuzz_binary$use_bench$use_tests" = "nonononononononono"; then
+ AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-daemon --with-gui --enable-fuzz(-binary) --enable-bench or --enable-tests])
fi
AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"])
@@ -1941,7 +1924,6 @@ echo
echo "Options used to compile and link:"
echo " external signer = $use_external_signer"
echo " multiprocess = $build_multiprocess"
-echo " with libs = $build_bitcoin_libs"
echo " with wallet = $enable_wallet"
if test "$enable_wallet" != "no"; then
echo " with sqlite = $use_sqlite"
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index b301369ad9..9624221880 100755
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -61,7 +61,6 @@ store_path() {
# Set environment variables to point the NATIVE toolchain to the right
# includes/libs
NATIVE_GCC="$(store_path gcc-toolchain)"
-NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
unset LIBRARY_PATH
unset CPATH
@@ -70,12 +69,21 @@ unset CPLUS_INCLUDE_PATH
unset OBJC_INCLUDE_PATH
unset OBJCPLUS_INCLUDE_PATH
-export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib"
export C_INCLUDE_PATH="${NATIVE_GCC}/include"
export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include"
export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
+case "$HOST" in
+ *darwin*)
+ export LIBRARY_PATH="${NATIVE_GCC}/lib"
+ ;;
+ *)
+ NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
+ export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC_STATIC}/lib"
+ ;;
+esac
+
# Set environment variables to point the CROSS toolchain to the right
# includes/libs for $HOST
case "$HOST" in
@@ -300,11 +308,9 @@ mkdir -p "$DISTSRC"
case "$HOST" in
*darwin*)
- make osx_volname ${V:+V=1}
make deploydir ${V:+V=1}
mkdir -p "unsigned-app-${HOST}"
cp --target-directory="unsigned-app-${HOST}" \
- osx_volname \
contrib/macdeploy/detached-sig-create.sh
mv --target-directory="unsigned-app-${HOST}" dist
(
@@ -321,26 +327,16 @@ mkdir -p "$DISTSRC"
(
cd installed
- case "$HOST" in
- *mingw*)
- mv --target-directory="$DISTNAME"/lib/ "$DISTNAME"/bin/*.dll
- ;;
- esac
-
# Prune libtool and object archives
find . -name "lib*.la" -delete
find . -name "lib*.a" -delete
- # Prune pkg-config files
- rm -rf "${DISTNAME}/lib/pkgconfig"
-
case "$HOST" in
*darwin*) ;;
*)
- # Split binaries and libraries from their debug symbols
+ # Split binaries from their debug symbols
{
find "${DISTNAME}/bin" -type f -executable -print0
- find "${DISTNAME}/lib" -type f -print0
} | xargs -0 -P"$JOBS" -I{} "${DISTSRC}/contrib/devtools/split-debug.sh" {} {} {}.dbg
;;
esac
diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
index e24a61bf9d..8f0147743d 100644
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -528,9 +528,8 @@ inspecting signatures in Mach-O binaries.")
(list gcc-toolchain-12 "static")
(make-bitcoin-cross-toolchain target)))
((string-contains target "darwin")
- (list ;; Native GCC 10 toolchain
- gcc-toolchain-10
- (list gcc-toolchain-10 "static")
+ (list ;; Native GCC 11 toolchain
+ gcc-toolchain-11
binutils
clang-toolchain-17
cmake-minimal
diff --git a/contrib/guix/patches/glibc-2.27-fcommon.patch b/contrib/guix/patches/glibc-2.27-fcommon.patch
index 817aa85bb9..f8d14837fc 100644
--- a/contrib/guix/patches/glibc-2.27-fcommon.patch
+++ b/contrib/guix/patches/glibc-2.27-fcommon.patch
@@ -5,7 +5,7 @@ Date: Fri May 6 11:03:04 2022 +0100
build: use -fcommon to retain legacy behaviour with GCC 10
GCC 10 started using -fno-common by default, which causes issues with
- the powerpc builds using gibc 2.27. A patch was commited to glibc to fix
+ the powerpc builds using gibc 2.27. A patch was committed to glibc to fix
the issue, 18363b4f010da9ba459b13310b113ac0647c2fcc but is non-trvial
to backport, and was broken in at least one way, see the followup in
commit 7650321ce037302bfc2f026aa19e0213b8d02fe6.
diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk
index 29ad7ef252..8beedcc98a 100644
--- a/depends/hosts/darwin.mk
+++ b/depends/hosts/darwin.mk
@@ -105,7 +105,7 @@ endif
darwin_release_CFLAGS=-O2
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
-darwin_debug_CFLAGS=-O1
+darwin_debug_CFLAGS=-O1 -g
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
darwin_cmake_system=Darwin
diff --git a/depends/hosts/linux.mk b/depends/hosts/linux.mk
index 8be23be57d..9cd28f0deb 100644
--- a/depends/hosts/linux.mk
+++ b/depends/hosts/linux.mk
@@ -10,7 +10,7 @@ endif
linux_release_CFLAGS=-O2
linux_release_CXXFLAGS=$(linux_release_CFLAGS)
-linux_debug_CFLAGS=-O1
+linux_debug_CFLAGS=-O1 -g
linux_debug_CXXFLAGS=$(linux_debug_CFLAGS)
linux_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -D_LIBCPP_ENABLE_DEBUG_MODE=1
diff --git a/depends/hosts/mingw32.mk b/depends/hosts/mingw32.mk
index 15aa7cd25a..4c657358f6 100644
--- a/depends/hosts/mingw32.mk
+++ b/depends/hosts/mingw32.mk
@@ -14,7 +14,7 @@ endif
mingw32_release_CFLAGS=-O2
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
-mingw32_debug_CFLAGS=-O1
+mingw32_debug_CFLAGS=-O1 -g
mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS)
mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC
diff --git a/depends/packages/expat.mk b/depends/packages/expat.mk
index 2db283ef3c..2ec660109c 100644
--- a/depends/packages/expat.mk
+++ b/depends/packages/expat.mk
@@ -6,7 +6,7 @@ $(package)_sha256_hash=f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df47
# -D_DEFAULT_SOURCE defines __USE_MISC, which exposes additional
# definitions in endian.h, which are required for a working
-# endianess check in configure when building with -flto.
+# endianness check in configure when building with -flto.
define $(package)_set_vars
$(package)_config_opts=--disable-shared --without-docbook --without-tests --without-examples
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking
diff --git a/depends/packages/libmultiprocess.mk b/depends/packages/libmultiprocess.mk
index 765d649377..c292c49bfb 100644
--- a/depends/packages/libmultiprocess.mk
+++ b/depends/packages/libmultiprocess.mk
@@ -20,7 +20,7 @@ define $(package)_config_cmds
endef
define $(package)_build_cmds
- $(MAKE)
+ $(MAKE) multiprocess
endef
define $(package)_stage_cmds
diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index 450d0dbea3..0acf4cf565 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -1,9 +1,9 @@
package=qt
-$(package)_version=5.15.11
+$(package)_version=5.15.13
$(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules
$(package)_suffix=everywhere-opensource-src-$($(package)_version).tar.xz
$(package)_file_name=qtbase-$($(package)_suffix)
-$(package)_sha256_hash=425ad301acd91ca66c10c0dabee0704e2d0cd2801a6b670115800cbb95f84846
+$(package)_sha256_hash=4cca51dcc1f22ceeee6b3e33cd1c3a60b14e85e24644dca3af89a2c2989ab809
$(package)_linux_dependencies=freetype fontconfig libxcb libxkbcommon libxcb_util libxcb_util_render libxcb_util_keysyms libxcb_util_image libxcb_util_wm
$(package)_qt_libs=corelib network widgets gui plugins testlib
$(package)_linguist_tools = lrelease lupdate lconvert
@@ -15,7 +15,6 @@ $(package)_patches += no-xlib.patch
$(package)_patches += fix_android_jni_static.patch
$(package)_patches += dont_hardcode_pwd.patch
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch
-$(package)_patches += use_android_ndk23.patch
$(package)_patches += rcc_hardcode_timestamp.patch
$(package)_patches += duplicate_lcqpafonts.patch
$(package)_patches += guix_cross_lib_path.patch
@@ -25,10 +24,10 @@ $(package)_patches += utc_from_string_no_optimize.patch
$(package)_patches += windows_lto.patch
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
-$(package)_qttranslations_sha256_hash=a31785948c640b7c66d9fe2db4993728ca07f64e41c560b3625ad191b276ff20
+$(package)_qttranslations_sha256_hash=24d4c58bc2a40c0f44f59ee64af4192c7d0038c1e45af61646cfc5b65058f271
$(package)_qttools_file_name=qttools-$($(package)_suffix)
-$(package)_qttools_sha256_hash=7cd847ae6ff09416df617136eadcaf0eb98e3bc9b89979219a3ea8111fb8d339
+$(package)_qttools_sha256_hash=57c9794c572c4e02871f2e7581525752b0cf85ea16cfab23a4ac9ba7b39a5d34
$(package)_extra_sources = $($(package)_qttranslations_file_name)
$(package)_extra_sources += $($(package)_qttools_file_name)
@@ -246,7 +245,6 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fix_android_jni_static.patch && \
patch -p1 -i $($(package)_patch_dir)/no-xlib.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
- patch -p1 -i $($(package)_patch_dir)/use_android_ndk23.patch && \
patch -p1 -i $($(package)_patch_dir)/memory_resource.patch && \
patch -p1 -i $($(package)_patch_dir)/rcc_hardcode_timestamp.patch && \
patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \
diff --git a/depends/packages/sqlite.mk b/depends/packages/sqlite.mk
index 7d175ec4bb..15bc0f4d7a 100644
--- a/depends/packages/sqlite.mk
+++ b/depends/packages/sqlite.mk
@@ -8,7 +8,6 @@ define $(package)_set_vars
$(package)_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking
$(package)_config_opts+= --disable-rtree --disable-fts4 --disable-fts5
# We avoid using `--enable-debug` because it overrides CFLAGS, a behavior we want to prevent.
-$(package)_cflags_debug += -g
$(package)_cppflags_debug += -DSQLITE_DEBUG
$(package)_cppflags+=-DSQLITE_DQS=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_OMIT_DEPRECATED
$(package)_cppflags+=-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_JSON -DSQLITE_LIKE_DOESNT_MATCH_BLOBS
diff --git a/depends/patches/qt/fix_android_jni_static.patch b/depends/patches/qt/fix_android_jni_static.patch
index 89c96026fb..79824f244a 100644
--- a/depends/patches/qt/fix_android_jni_static.patch
+++ b/depends/patches/qt/fix_android_jni_static.patch
@@ -15,4 +15,3 @@
QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
m_javaVM = vm;
-
diff --git a/depends/patches/qt/memory_resource.patch b/depends/patches/qt/memory_resource.patch
index 650c328528..312f0669f6 100644
--- a/depends/patches/qt/memory_resource.patch
+++ b/depends/patches/qt/memory_resource.patch
@@ -17,7 +17,7 @@ and https://bugreports.qt.io/browse/QTBUG-114316
--- a/qtbase/src/corelib/global/qcompilerdetection.h
+++ b/qtbase/src/corelib/global/qcompilerdetection.h
-@@ -1050,16 +1050,22 @@
+@@ -1055,16 +1055,22 @@
# endif // !_HAS_CONSTEXPR
# endif // !__GLIBCXX__ && !_LIBCPP_VERSION
# endif // Q_OS_QNX
diff --git a/depends/patches/qt/use_android_ndk23.patch b/depends/patches/qt/use_android_ndk23.patch
deleted file mode 100644
index f22367d527..0000000000
--- a/depends/patches/qt/use_android_ndk23.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Use Android NDK r23 LTS
-
---- old/qtbase/mkspecs/features/android/default_pre.prf
-+++ new/qtbase/mkspecs/features/android/default_pre.prf
-@@ -76,7 +76,7 @@ else: equals(QT_ARCH, x86_64): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/x86_64-linux-
- else: equals(QT_ARCH, arm64-v8a): CROSS_COMPILE = $$NDK_LLVM_PATH/bin/aarch64-linux-android-
- else: CROSS_COMPILE = $$NDK_LLVM_PATH/bin/arm-linux-androideabi-
-
--QMAKE_RANLIB = $${CROSS_COMPILE}ranlib
-+QMAKE_RANLIB = $$NDK_LLVM_PATH/bin/llvm-ranlib
- QMAKE_LINK_SHLIB = $$QMAKE_LINK
- QMAKE_LFLAGS =
-
diff --git a/doc/README.md b/doc/README.md
index 446684b482..7b6dacaf4f 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -59,7 +59,6 @@ The Bitcoin repo's [root README](/README.md) contains relevant information on th
- [Translation Strings Policy](translation_strings_policy.md)
- [JSON-RPC Interface](JSON-RPC-interface.md)
- [Unauthenticated REST Interface](REST-interface.md)
-- [Shared Libraries](shared-libraries.md)
- [BIPS](bips.md)
- [Dnsseed Policy](dnsseed-policy.md)
- [Benchmarking](benchmarking.md)
diff --git a/doc/build-unix.md b/doc/build-unix.md
index bf367fc421..de54fb4eeb 100644
--- a/doc/build-unix.md
+++ b/doc/build-unix.md
@@ -30,7 +30,7 @@ tuned to conserve memory with additional CXXFLAGS:
Alternatively, or in addition, debugging information can be skipped for compilation. The default compile flags are
`-g -O2`, and can be changed with:
- ./configure CXXFLAGS="-O2"
+ ./configure CXXFLAGS="-g0"
Finally, clang (often less resource hungry) can be used instead of gcc, which is used by default:
@@ -81,7 +81,7 @@ To build without GUI pass `--without-gui`.
To build with Qt 5 you need the following:
- sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools
+ sudo apt-get install qtbase5-dev qttools5-dev qttools5-dev-tools
Additionally, to support Wayland protocol for modern desktop environments:
diff --git a/doc/dependencies.md b/doc/dependencies.md
index 237f617c02..1e48d225b0 100644
--- a/doc/dependencies.md
+++ b/doc/dependencies.md
@@ -30,7 +30,7 @@ You can find installation instructions in the `build-*.md` file for your platfor
| [Fontconfig](../depends/packages/fontconfig.mk) | [link](https://www.freedesktop.org/wiki/Software/fontconfig/) | [2.12.6](https://github.com/bitcoin/bitcoin/pull/23495) | 2.6 | Yes |
| [FreeType](../depends/packages/freetype.mk) | [link](https://freetype.org) | [2.11.0](https://github.com/bitcoin/bitcoin/commit/01544dd78ccc0b0474571da854e27adef97137fb) | 2.3.0 | Yes |
| [qrencode](../depends/packages/qrencode.mk) | [link](https://fukuchi.org/works/qrencode/) | [4.1.1](https://github.com/bitcoin/bitcoin/pull/27312) | | No |
-| [Qt](../depends/packages/qt.mk) | [link](https://download.qt.io/official_releases/qt/) | [5.15.11](https://github.com/bitcoin/bitcoin/pull/28769) | [5.11.3](https://github.com/bitcoin/bitcoin/pull/24132) | No |
+| [Qt](../depends/packages/qt.mk) | [link](https://download.qt.io/official_releases/qt/) | [5.15.13](https://github.com/bitcoin/bitcoin/pull/29732) | [5.11.3](https://github.com/bitcoin/bitcoin/pull/24132) | No |
### Networking
| Dependency | Releases | Version used | Minimum required | Runtime |
diff --git a/doc/design/libraries.md b/doc/design/libraries.md
index 7cda64e713..3346c8e81b 100644
--- a/doc/design/libraries.md
+++ b/doc/design/libraries.md
@@ -4,10 +4,9 @@
|--------------------------|-------------|
| *libbitcoin_cli* | RPC client functionality used by *bitcoin-cli* executable |
| *libbitcoin_common* | Home for common functionality shared by different executables and libraries. Similar to *libbitcoin_util*, but higher-level (see [Dependencies](#dependencies)). |
-| *libbitcoin_consensus* | Stable, backwards-compatible consensus functionality used by *libbitcoin_node* and *libbitcoin_wallet* and also exposed as a [shared library](../shared-libraries.md). |
-| *libbitcoinconsensus* | Shared library build of static *libbitcoin_consensus* library |
-| *libbitcoin_kernel* | Consensus engine and support library used for validation by *libbitcoin_node* and also exposed as a [shared library](../shared-libraries.md). |
-| *libbitcoinqt* | GUI functionality used by *bitcoin-qt* and *bitcoin-gui* executables |
+| *libbitcoin_consensus* | Stable, backwards-compatible consensus functionality used by *libbitcoin_node* and *libbitcoin_wallet*. |
+| *libbitcoin_kernel* | Consensus engine and support library used for validation by *libbitcoin_node*. |
+| *libbitcoinqt* | GUI functionality used by *bitcoin-qt* and *bitcoin-gui* executables. |
| *libbitcoin_ipc* | IPC functionality used by *bitcoin-node*, *bitcoin-wallet*, *bitcoin-gui* executables to communicate when [`--enable-multiprocess`](multiprocess.md) is used. |
| *libbitcoin_node* | P2P and RPC server functionality used by *bitcoind* and *bitcoin-qt* executables. |
| *libbitcoin_util* | Home for common functionality shared by different executables and libraries. Similar to *libbitcoin_common*, but lower-level (see [Dependencies](#dependencies)). |
@@ -17,7 +16,7 @@
## Conventions
-- Most libraries are internal libraries and have APIs which are completely unstable! There are few or no restrictions on backwards compatibility or rules about external dependencies. Exceptions are *libbitcoin_consensus* and *libbitcoin_kernel* which have external interfaces documented at [../shared-libraries.md](../shared-libraries.md).
+- Most libraries are internal libraries and have APIs which are completely unstable! There are few or no restrictions on backwards compatibility or rules about external dependencies. An exception is *libbitcoin_kernel*, which, at some future point, will have a documented external interface.
- Generally each library should have a corresponding source directory and namespace. Source code organization is a work in progress, so it is true that some namespaces are applied inconsistently, and if you look at [`libbitcoin_*_SOURCES`](../../src/Makefile.am) lists you can see that many libraries pull in files from outside their source directory. But when working with libraries, it is good to follow a consistent pattern like:
diff --git a/doc/dnsseed-policy.md b/doc/dnsseed-policy.md
index 55a5c28258..99f48f2670 100644
--- a/doc/dnsseed-policy.md
+++ b/doc/dnsseed-policy.md
@@ -44,7 +44,7 @@ related to the DNS seed operation.
If these expectations cannot be satisfied the operator should
discontinue providing services and contact the active Bitcoin
Core development team as well as posting on
-[bitcoin-dev](https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev).
+[bitcoin-dev](https://groups.google.com/g/bitcoindev).
Behavior outside of these expectations may be reasonable in some
situations but should be discussed in public in advance.
diff --git a/doc/release-notes/release-notes-26.1.md b/doc/release-notes/release-notes-26.1.md
new file mode 100644
index 0000000000..b5c6e63007
--- /dev/null
+++ b/doc/release-notes/release-notes-26.1.md
@@ -0,0 +1,106 @@
+26.1 Release Notes
+==================
+
+Bitcoin Core version 26.1 is now available from:
+
+ <https://bitcoincore.org/bin/bitcoin-core-26.1/>
+
+This release includes various bug fixes and performance
+improvements, as well as updated translations.
+
+Please report bugs using the issue tracker at GitHub:
+
+ <https://github.com/bitcoin/bitcoin/issues>
+
+To receive security and update notifications, please subscribe to:
+
+ <https://bitcoincore.org/en/list/announcements/join/>
+
+How to Upgrade
+==============
+
+If you are running an older version, shut it down. Wait until it has completely
+shut down (which might take a few minutes in some cases), then run the
+installer (on Windows) or just copy over `/Applications/Bitcoin-Qt` (on macOS)
+or `bitcoind`/`bitcoin-qt` (on Linux).
+
+Upgrading directly from a version of Bitcoin Core that has reached its EOL is
+possible, but it might take some time if the data directory needs to be migrated. Old
+wallet versions of Bitcoin Core are generally supported.
+
+Compatibility
+==============
+
+Bitcoin Core is supported and extensively tested on operating systems
+using the Linux kernel, macOS 11.0+, and Windows 7 and newer. Bitcoin
+Core should also work on most other Unix-like systems but is not as
+frequently tested on them. It is not recommended to use Bitcoin Core on
+unsupported systems.
+
+Notable changes
+===============
+
+### Wallet
+
+- #28994 wallet: skip BnB when SFFO is enabled
+- #28920 wallet: birth time update during tx scanning
+- #29176 wallet: Fix use-after-free in WalletBatch::EraseRecords
+- #29510 wallet: getrawchangeaddress and getnewaddress failures should not affect keypools for descriptor wallets
+
+### RPC
+
+- #29003 rpc: fix getrawtransaction segfault
+- #28784 rpc: keep .cookie file if it was not generated
+
+### Logs
+
+- #29227 log mempool loading progress
+
+### P2P and network changes
+
+- #29200 net: create I2P sessions using both ECIES-X25519 and ElGamal encryption
+- #29412 p2p: Don't process mutated blocks
+- #29524 p2p: Don't consider blocks mutated if they don't connect to known prev block
+
+### Build
+
+- #29127 Use hardened runtime on macOS release builds.
+- #29195 build: Fix -Xclang -internal-isystem option
+
+### CI
+
+- #28992 ci: Use Ubuntu 24.04 Noble for asan,tsan,tidy,fuzz
+- #29080 ci: Set HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK to avoid unrelated failures
+- #29610 ci: Fix "macOS native" job
+
+### Miscellaneous
+
+- #28391 refactor: Simplify CTxMempool/BlockAssembler fields, remove some external mapTx access
+- #29179 test: wallet rescan with reorged parent + IsFromMe child in mempool
+- #28791 snapshots: don't core dump when running -checkblockindex after loadtxoutset
+- #29357 test: Drop x modifier in fsbridge::fopen call for MinGW builds
+- #29529 fuzz: restrict fopencookie usage to Linux & FreeBSD
+
+Credits
+=======
+
+Thanks to everyone who directly contributed to this release:
+
+- dergoegge
+- fanquake
+- furszy
+- glozow
+- Greg Sanders
+- Hennadii Stepanov
+- Jon Atack
+- MarcoFalke
+- Mark Friedenbach
+- Martin Zumsande
+- Murch
+- Roman Zeyde
+- stickies-v
+- UdjinM6
+
+As well as to everyone that helped with translations on
+[Transifex](https://www.transifex.com/bitcoin/bitcoin/).
+
diff --git a/doc/shared-libraries.md b/doc/shared-libraries.md
deleted file mode 100644
index 3a448c6556..0000000000
--- a/doc/shared-libraries.md
+++ /dev/null
@@ -1,78 +0,0 @@
-Shared Libraries
-================
-
-## bitcoinconsensus
-***This library is deprecated and will be removed in v28***
-
-The purpose of this library is to make the verification functionality that is critical to Bitcoin's consensus available to other applications, e.g. to language bindings.
-
-### API
-
-The interface is defined in the C header `bitcoinconsensus.h` located in `src/script/bitcoinconsensus.h`.
-
-#### Version
-
-`bitcoinconsensus_version` returns an `unsigned int` with the API version *(currently `2`)*.
-
-#### Script Validation
-
-`bitcoinconsensus_verify_script`, `bitcoinconsensus_verify_script_with_amount` and `bitcoinconsensus_verify_script_with_spent_outputs` return an `int` with the status of the verification. It will be `1` if the input script correctly spends the previous output `scriptPubKey`.
-
-##### Parameters
-###### bitcoinconsensus_verify_script
-- `const unsigned char *scriptPubKey` - The previous output script that encumbers spending.
-- `unsigned int scriptPubKeyLen` - The number of bytes for the `scriptPubKey`.
-- `const unsigned char *txTo` - The transaction with the input that is spending the previous output.
-- `unsigned int txToLen` - The number of bytes for the `txTo`.
-- `unsigned int nIn` - The index of the input in `txTo` that spends the `scriptPubKey`.
-- `unsigned int flags` - The script validation flags *(see below)*.
-- `bitcoinconsensus_error* err` - Will have the error/success code for the operation *(see below)*.
-
-###### bitcoinconsensus_verify_script_with_amount
-- `const unsigned char *scriptPubKey` - The previous output script that encumbers spending.
-- `unsigned int scriptPubKeyLen` - The number of bytes for the `scriptPubKey`.
-- `int64_t amount` - The amount spent in the input
-- `const unsigned char *txTo` - The transaction with the input that is spending the previous output.
-- `unsigned int txToLen` - The number of bytes for the `txTo`.
-- `unsigned int nIn` - The index of the input in `txTo` that spends the `scriptPubKey`.
-- `unsigned int flags` - The script validation flags *(see below)*.
-- `bitcoinconsensus_error* err` - Will have the error/success code for the operation *(see below)*.
-
-###### bitcoinconsensus_verify_script_with_spent_outputs
-- `const unsigned char *scriptPubKey` - The previous output script that encumbers spending.
-- `unsigned int scriptPubKeyLen` - The number of bytes for the `scriptPubKey`.
-- `int64_t amount` - The amount spent in the input
-- `const unsigned char *txTo` - The transaction with the input that is spending the previous output.
-- `unsigned int txToLen` - The number of bytes for the `txTo`.
-- `UTXO *spentOutputs` - Previous outputs spent in the transaction. `UTXO` is a struct composed by `const unsigned char *scriptPubKey`, `unsigned int scriptPubKeySize` (the number of bytes for the `scriptPubKey`) and `unsigned int value`.
-- `unsigned int spentOutputsLen` - The number of bytes for the `spentOutputs`.
-- `unsigned int nIn` - The index of the input in `txTo` that spends the `scriptPubKey`.
-- `unsigned int flags` - The script validation flags *(see below)*.
-- `bitcoinconsensus_error* err` - Will have the error/success code for the operation *(see below)*.
-
-##### Script Flags
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE`
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH` - Evaluate P2SH ([BIP16](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki)) subscripts
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG` - Enforce strict DER ([BIP66](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki)) compliance
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY` - Enforce NULLDUMMY ([BIP147](https://github.com/bitcoin/bips/blob/master/bip-0147.mediawiki))
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY` - Enable CHECKLOCKTIMEVERIFY ([BIP65](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki))
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY` - Enable CHECKSEQUENCEVERIFY ([BIP112](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki))
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS` - Enable WITNESS ([BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki))
-- `bitcoinconsensus_SCRIPT_FLAGS_VERIFY_TAPROOT` - Enable TAPROOT ([BIP340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki), [BIP341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki), [BIP342](https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki))
-
-##### Errors
-- `bitcoinconsensus_ERR_OK` - No errors with input parameters *(see the return value of `bitcoinconsensus_verify_script` for the verification status)*
-- `bitcoinconsensus_ERR_TX_INDEX` - An invalid index for `txTo`
-- `bitcoinconsensus_ERR_TX_SIZE_MISMATCH` - `txToLen` did not match with the size of `txTo`
-- `bitcoinconsensus_ERR_DESERIALIZE` - An error deserializing `txTo`
-- `bitcoinconsensus_ERR_AMOUNT_REQUIRED` - Input amount is required if WITNESS is used
-- `bitcoinconsensus_ERR_INVALID_FLAGS` - Script verification `flags` are invalid (i.e. not part of the libconsensus interface)
-- `bitcoinconsensus_ERR_SPENT_OUTPUTS_REQUIRED` - Spent outputs are required if TAPROOT is used
-- `bitcoinconsensus_ERR_SPENT_OUTPUTS_MISMATCH` - Spent outputs size doesn't match tx inputs size
-
-### Example Implementations
-- [NBitcoin](https://github.com/MetacoSA/NBitcoin/blob/5e1055cd7c4186dee4227c344af8892aea54faec/NBitcoin/Script.cs#L979-#L1031) (.NET Bindings)
-- [node-libbitcoinconsensus](https://github.com/bitpay/node-libbitcoinconsensus) (Node.js Bindings)
-- [java-libbitcoinconsensus](https://github.com/dexX7/java-libbitcoinconsensus) (Java Bindings)
-- [bitcoinconsensus-php](https://github.com/Bit-Wasp/bitcoinconsensus-php) (PHP Bindings)
-- [rust-bitcoinconsensus](https://github.com/rust-bitcoin/rust-bitcoinconsensus) (Rust Bindings) \ No newline at end of file
diff --git a/libbitcoinconsensus.pc.in b/libbitcoinconsensus.pc.in
deleted file mode 100644
index 1ceab280bb..0000000000
--- a/libbitcoinconsensus.pc.in
+++ /dev/null
@@ -1,10 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: @PACKAGE_NAME@ consensus library
-Description: Library for the Bitcoin consensus protocol.
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lbitcoinconsensus
-Cflags: -I${includedir}
diff --git a/src/Makefile.am b/src/Makefile.am
index 0328dfc2cd..11b8f6e4c3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,9 +39,6 @@ LIBSECP256K1=secp256k1/libsecp256k1.la
if ENABLE_ZMQ
LIBBITCOIN_ZMQ=libbitcoin_zmq.a
endif
-if BUILD_BITCOIN_LIBS
-LIBBITCOINCONSENSUS=libbitcoinconsensus.la
-endif
if BUILD_BITCOIN_KERNEL_LIB
LIBBITCOINKERNEL=libbitcoinkernel.la
endif
@@ -649,7 +646,6 @@ libbitcoin_consensus_a_SOURCES = \
primitives/transaction.h \
pubkey.cpp \
pubkey.h \
- script/bitcoinconsensus.cpp \
script/interpreter.cpp \
script/interpreter.h \
script/script.cpp \
@@ -1010,21 +1006,6 @@ libbitcoinkernel_la-clientversion.l$(OBJEXT): obj/build.h
endif # BUILD_BITCOIN_KERNEL_LIB
#
-# bitcoinconsensus library #
-if BUILD_BITCOIN_LIBS
-lib_LTLIBRARIES += $(LIBBITCOINCONSENSUS)
-
-include_HEADERS = script/bitcoinconsensus.h
-libbitcoinconsensus_la_SOURCES = support/cleanse.cpp $(crypto_libbitcoin_crypto_base_la_SOURCES) $(libbitcoin_consensus_a_SOURCES)
-
-libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
-libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
-libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL -DDISABLE_OPTIMIZED_SHA256
-libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
-
-endif
-#
-
CTAES_DIST = crypto/ctaes/bench.c
CTAES_DIST += crypto/ctaes/ctaes.c
CTAES_DIST += crypto/ctaes/ctaes.h
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index d345b41a0a..cf88a02b95 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -365,7 +365,6 @@ test_fuzz_fuzz_SOURCES = \
test/fuzz/rpc.cpp \
test/fuzz/script.cpp \
test/fuzz/script_assets_test_minimizer.cpp \
- test/fuzz/script_bitcoin_consensus.cpp \
test/fuzz/script_descriptor_cache.cpp \
test/fuzz/script_flags.cpp \
test/fuzz/script_format.cpp \
diff --git a/src/bench/verify_script.cpp b/src/bench/verify_script.cpp
index e7166a91cf..ee750bc1f8 100644
--- a/src/bench/verify_script.cpp
+++ b/src/bench/verify_script.cpp
@@ -2,15 +2,8 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
-
#include <bench/bench.h>
#include <key.h>
-#if defined(HAVE_CONSENSUS_LIB)
-#include <script/bitcoinconsensus.h>
-#endif
#include <script/script.h>
#include <script/interpreter.h>
#include <streams.h>
@@ -63,17 +56,6 @@ static void VerifyScriptBench(benchmark::Bench& bench)
&err);
assert(err == SCRIPT_ERR_OK);
assert(success);
-
-#if defined(HAVE_CONSENSUS_LIB)
- DataStream stream;
- stream << TX_WITH_WITNESS(txSpend);
- int csuccess = bitcoinconsensus_verify_script_with_amount(
- txCredit.vout[0].scriptPubKey.data(),
- txCredit.vout[0].scriptPubKey.size(),
- txCredit.vout[0].nValue,
- (const unsigned char*)stream.data(), stream.size(), 0, flags, nullptr);
- assert(csuccess == 1);
-#endif
});
ECC_Stop();
}
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index f0e27cb675..129deeec60 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -827,7 +827,10 @@ static UniValue CallRPC(BaseRequestHandler* rh, const std::string& strMethod, co
if (response.error != -1) {
responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error));
}
- throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the bitcoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
+ throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\n"
+ "Make sure the bitcoind server is running and that you are connecting to the correct RPC port.\n"
+ "Use \"bitcoin-cli -help\" for more info.",
+ host, port, responseErrorMessage));
} else if (response.status == HTTP_UNAUTHORIZED) {
if (failedToGetAuthCookie) {
throw std::runtime_error(strprintf(
diff --git a/src/cuckoocache.h b/src/cuckoocache.h
index cb0b362143..df320ed465 100644
--- a/src/cuckoocache.h
+++ b/src/cuckoocache.h
@@ -359,7 +359,7 @@ public:
* @param bytes the approximate number of bytes to use for this data
* structure
* @returns A pair of the maximum number of elements storable (see setup()
- * documentation for more detail) and the approxmiate total size of these
+ * documentation for more detail) and the approximate total size of these
* elements in bytes or std::nullopt if the size requested is too large.
*/
std::optional<std::pair<uint32_t, size_t>> setup_bytes(size_t bytes)
diff --git a/src/logging.cpp b/src/logging.cpp
index 42f100ded6..578650f856 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -9,9 +9,8 @@
#include <util/threadnames.h>
#include <util/time.h>
-#include <algorithm>
#include <array>
-#include <mutex>
+#include <map>
#include <optional>
const char * const DEFAULT_DEBUGLOGFILE = "debug.log";
@@ -142,49 +141,57 @@ bool BCLog::Logger::DefaultShrinkDebugFile() const
return m_categories == BCLog::NONE;
}
-struct CLogCategoryDesc {
- BCLog::LogFlags flag;
- std::string category;
-};
-
-const CLogCategoryDesc LogCategories[] =
-{
- {BCLog::NONE, "0"},
- {BCLog::NONE, ""},
- {BCLog::NET, "net"},
- {BCLog::TOR, "tor"},
- {BCLog::MEMPOOL, "mempool"},
- {BCLog::HTTP, "http"},
- {BCLog::BENCH, "bench"},
- {BCLog::ZMQ, "zmq"},
- {BCLog::WALLETDB, "walletdb"},
- {BCLog::RPC, "rpc"},
- {BCLog::ESTIMATEFEE, "estimatefee"},
- {BCLog::ADDRMAN, "addrman"},
- {BCLog::SELECTCOINS, "selectcoins"},
- {BCLog::REINDEX, "reindex"},
- {BCLog::CMPCTBLOCK, "cmpctblock"},
- {BCLog::RAND, "rand"},
- {BCLog::PRUNE, "prune"},
- {BCLog::PROXY, "proxy"},
- {BCLog::MEMPOOLREJ, "mempoolrej"},
- {BCLog::LIBEVENT, "libevent"},
- {BCLog::COINDB, "coindb"},
- {BCLog::QT, "qt"},
- {BCLog::LEVELDB, "leveldb"},
- {BCLog::VALIDATION, "validation"},
- {BCLog::I2P, "i2p"},
- {BCLog::IPC, "ipc"},
+static const std::map<std::string, BCLog::LogFlags> LOG_CATEGORIES_BY_STR{
+ {"0", BCLog::NONE},
+ {"", BCLog::NONE},
+ {"net", BCLog::NET},
+ {"tor", BCLog::TOR},
+ {"mempool", BCLog::MEMPOOL},
+ {"http", BCLog::HTTP},
+ {"bench", BCLog::BENCH},
+ {"zmq", BCLog::ZMQ},
+ {"walletdb", BCLog::WALLETDB},
+ {"rpc", BCLog::RPC},
+ {"estimatefee", BCLog::ESTIMATEFEE},
+ {"addrman", BCLog::ADDRMAN},
+ {"selectcoins", BCLog::SELECTCOINS},
+ {"reindex", BCLog::REINDEX},
+ {"cmpctblock", BCLog::CMPCTBLOCK},
+ {"rand", BCLog::RAND},
+ {"prune", BCLog::PRUNE},
+ {"proxy", BCLog::PROXY},
+ {"mempoolrej", BCLog::MEMPOOLREJ},
+ {"libevent", BCLog::LIBEVENT},
+ {"coindb", BCLog::COINDB},
+ {"qt", BCLog::QT},
+ {"leveldb", BCLog::LEVELDB},
+ {"validation", BCLog::VALIDATION},
+ {"i2p", BCLog::I2P},
+ {"ipc", BCLog::IPC},
#ifdef DEBUG_LOCKCONTENTION
- {BCLog::LOCK, "lock"},
+ {"lock", BCLog::LOCK},
#endif
- {BCLog::UTIL, "util"},
- {BCLog::BLOCKSTORAGE, "blockstorage"},
- {BCLog::TXRECONCILIATION, "txreconciliation"},
- {BCLog::SCAN, "scan"},
- {BCLog::TXPACKAGES, "txpackages"},
- {BCLog::ALL, "1"},
- {BCLog::ALL, "all"},
+ {"blockstorage", BCLog::BLOCKSTORAGE},
+ {"txreconciliation", BCLog::TXRECONCILIATION},
+ {"scan", BCLog::SCAN},
+ {"txpackages", BCLog::TXPACKAGES},
+ {"1", BCLog::ALL},
+ {"all", BCLog::ALL},
+};
+
+static const std::unordered_map<BCLog::LogFlags, std::string> LOG_CATEGORIES_BY_FLAG{
+ // Swap keys and values from LOG_CATEGORIES_BY_STR.
+ [](const std::map<std::string, BCLog::LogFlags>& in) {
+ std::unordered_map<BCLog::LogFlags, std::string> out;
+ for (const auto& [k, v] : in) {
+ switch (v) {
+ case BCLog::NONE: out.emplace(BCLog::NONE, ""); break;
+ case BCLog::ALL: out.emplace(BCLog::ALL, "all"); break;
+ default: out.emplace(v, k);
+ }
+ }
+ return out;
+ }(LOG_CATEGORIES_BY_STR)
};
bool GetLogCategory(BCLog::LogFlags& flag, const std::string& str)
@@ -193,11 +200,10 @@ bool GetLogCategory(BCLog::LogFlags& flag, const std::string& str)
flag = BCLog::ALL;
return true;
}
- for (const CLogCategoryDesc& category_desc : LogCategories) {
- if (category_desc.category == str) {
- flag = category_desc.flag;
- return true;
- }
+ auto it = LOG_CATEGORIES_BY_STR.find(str);
+ if (it != LOG_CATEGORIES_BY_STR.end()) {
+ flag = it->second;
+ return true;
}
return false;
}
@@ -221,76 +227,9 @@ std::string BCLog::Logger::LogLevelToStr(BCLog::Level level)
std::string LogCategoryToStr(BCLog::LogFlags category)
{
- // Each log category string representation should sync with LogCategories
- switch (category) {
- case BCLog::LogFlags::NONE:
- return "";
- case BCLog::LogFlags::NET:
- return "net";
- case BCLog::LogFlags::TOR:
- return "tor";
- case BCLog::LogFlags::MEMPOOL:
- return "mempool";
- case BCLog::LogFlags::HTTP:
- return "http";
- case BCLog::LogFlags::BENCH:
- return "bench";
- case BCLog::LogFlags::ZMQ:
- return "zmq";
- case BCLog::LogFlags::WALLETDB:
- return "walletdb";
- case BCLog::LogFlags::RPC:
- return "rpc";
- case BCLog::LogFlags::ESTIMATEFEE:
- return "estimatefee";
- case BCLog::LogFlags::ADDRMAN:
- return "addrman";
- case BCLog::LogFlags::SELECTCOINS:
- return "selectcoins";
- case BCLog::LogFlags::REINDEX:
- return "reindex";
- case BCLog::LogFlags::CMPCTBLOCK:
- return "cmpctblock";
- case BCLog::LogFlags::RAND:
- return "rand";
- case BCLog::LogFlags::PRUNE:
- return "prune";
- case BCLog::LogFlags::PROXY:
- return "proxy";
- case BCLog::LogFlags::MEMPOOLREJ:
- return "mempoolrej";
- case BCLog::LogFlags::LIBEVENT:
- return "libevent";
- case BCLog::LogFlags::COINDB:
- return "coindb";
- case BCLog::LogFlags::QT:
- return "qt";
- case BCLog::LogFlags::LEVELDB:
- return "leveldb";
- case BCLog::LogFlags::VALIDATION:
- return "validation";
- case BCLog::LogFlags::I2P:
- return "i2p";
- case BCLog::LogFlags::IPC:
- return "ipc";
-#ifdef DEBUG_LOCKCONTENTION
- case BCLog::LogFlags::LOCK:
- return "lock";
-#endif
- case BCLog::LogFlags::UTIL:
- return "util";
- case BCLog::LogFlags::BLOCKSTORAGE:
- return "blockstorage";
- case BCLog::LogFlags::TXRECONCILIATION:
- return "txreconciliation";
- case BCLog::LogFlags::SCAN:
- return "scan";
- case BCLog::LogFlags::TXPACKAGES:
- return "txpackages";
- case BCLog::LogFlags::ALL:
- return "all";
- }
- assert(false);
+ auto it = LOG_CATEGORIES_BY_FLAG.find(category);
+ assert(it != LOG_CATEGORIES_BY_FLAG.end());
+ return it->second;
}
static std::optional<BCLog::Level> GetLogLevel(const std::string& level_str)
@@ -312,18 +251,11 @@ static std::optional<BCLog::Level> GetLogLevel(const std::string& level_str)
std::vector<LogCategory> BCLog::Logger::LogCategoriesList() const
{
- // Sort log categories by alphabetical order.
- std::array<CLogCategoryDesc, std::size(LogCategories)> categories;
- std::copy(std::begin(LogCategories), std::end(LogCategories), categories.begin());
- std::sort(categories.begin(), categories.end(), [](auto a, auto b) { return a.category < b.category; });
-
std::vector<LogCategory> ret;
- for (const CLogCategoryDesc& category_desc : categories) {
- if (category_desc.flag == BCLog::NONE || category_desc.flag == BCLog::ALL) continue;
- LogCategory catActive;
- catActive.category = category_desc.category;
- catActive.active = WillLogCategory(category_desc.flag);
- ret.push_back(catActive);
+ for (const auto& [category, flag] : LOG_CATEGORIES_BY_STR) {
+ if (flag != BCLog::NONE && flag != BCLog::ALL) {
+ ret.push_back(LogCategory{.category = category, .active = WillLogCategory(flag)});
+ }
}
return ret;
}
diff --git a/src/logging.h b/src/logging.h
index 2d358a52f1..cfef65221f 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -65,11 +65,10 @@ namespace BCLog {
#ifdef DEBUG_LOCKCONTENTION
LOCK = (1 << 24),
#endif
- UTIL = (1 << 25),
- BLOCKSTORAGE = (1 << 26),
- TXRECONCILIATION = (1 << 27),
- SCAN = (1 << 28),
- TXPACKAGES = (1 << 29),
+ BLOCKSTORAGE = (1 << 25),
+ TXRECONCILIATION = (1 << 26),
+ SCAN = (1 << 27),
+ TXPACKAGES = (1 << 28),
ALL = ~(uint32_t)0,
};
enum class Level {
diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp
deleted file mode 100644
index c4eccacf41..0000000000
--- a/src/script/bitcoinconsensus.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-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.
-
-#include <script/bitcoinconsensus.h>
-
-#include <primitives/transaction.h>
-#include <pubkey.h>
-#include <script/interpreter.h>
-
-namespace {
-
-/** A class that deserializes a single CTransaction one time. */
-class TxInputStream
-{
-public:
- TxInputStream(const unsigned char *txTo, size_t txToLen) :
- m_data(txTo),
- m_remaining(txToLen)
- {}
-
- void read(Span<std::byte> dst)
- {
- if (dst.size() > m_remaining) {
- throw std::ios_base::failure(std::string(__func__) + ": end of data");
- }
-
- if (dst.data() == nullptr) {
- throw std::ios_base::failure(std::string(__func__) + ": bad destination buffer");
- }
-
- if (m_data == nullptr) {
- throw std::ios_base::failure(std::string(__func__) + ": bad source buffer");
- }
-
- memcpy(dst.data(), m_data, dst.size());
- m_remaining -= dst.size();
- m_data += dst.size();
- }
-
- template<typename T>
- TxInputStream& operator>>(T&& obj)
- {
- ::Unserialize(*this, obj);
- return *this;
- }
-
-private:
- const unsigned char* m_data;
- size_t m_remaining;
-};
-
-inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
-{
- if (ret)
- *ret = serror;
- return 0;
-}
-
-} // namespace
-
-/** Check that all specified flags are part of the libconsensus interface. */
-static bool verify_flags(unsigned int flags)
-{
- return (flags & ~(bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL)) == 0;
-}
-
-static int verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, CAmount amount,
- const unsigned char *txTo , unsigned int txToLen,
- const UTXO *spentOutputs, unsigned int spentOutputsLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
-{
- if (!verify_flags(flags)) {
- return set_error(err, bitcoinconsensus_ERR_INVALID_FLAGS);
- }
-
- if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_TAPROOT && spentOutputs == nullptr) {
- return set_error(err, bitcoinconsensus_ERR_SPENT_OUTPUTS_REQUIRED);
- }
-
- try {
- TxInputStream stream(txTo, txToLen);
- CTransaction tx(deserialize, TX_WITH_WITNESS, stream);
-
- std::vector<CTxOut> spent_outputs;
- if (spentOutputs != nullptr) {
- if (spentOutputsLen != tx.vin.size()) {
- return set_error(err, bitcoinconsensus_ERR_SPENT_OUTPUTS_MISMATCH);
- }
- for (size_t i = 0; i < spentOutputsLen; i++) {
- CScript spk = CScript(spentOutputs[i].scriptPubKey, spentOutputs[i].scriptPubKey + spentOutputs[i].scriptPubKeySize);
- const CAmount& value = spentOutputs[i].value;
- CTxOut tx_out = CTxOut(value, spk);
- spent_outputs.push_back(tx_out);
- }
- }
-
- if (nIn >= tx.vin.size())
- return set_error(err, bitcoinconsensus_ERR_TX_INDEX);
- if (GetSerializeSize(TX_WITH_WITNESS(tx)) != txToLen)
- return set_error(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
-
- // Regardless of the verification result, the tx did not error.
- set_error(err, bitcoinconsensus_ERR_OK);
-
- PrecomputedTransactionData txdata(tx);
-
- if (spentOutputs != nullptr && flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_TAPROOT) {
- txdata.Init(tx, std::move(spent_outputs));
- }
-
- return VerifyScript(tx.vin[nIn].scriptSig, CScript(scriptPubKey, scriptPubKey + scriptPubKeyLen), &tx.vin[nIn].scriptWitness, flags, TransactionSignatureChecker(&tx, nIn, amount, txdata, MissingDataBehavior::FAIL), nullptr);
- } catch (const std::exception&) {
- return set_error(err, bitcoinconsensus_ERR_TX_DESERIALIZE); // Error deserializing
- }
-}
-
-int bitcoinconsensus_verify_script_with_spent_outputs(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
- const unsigned char *txTo , unsigned int txToLen,
- const UTXO *spentOutputs, unsigned int spentOutputsLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
-{
- CAmount am(amount);
- return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, spentOutputs, spentOutputsLen, nIn, flags, err);
-}
-
-int bitcoinconsensus_verify_script_with_amount(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
- const unsigned char *txTo , unsigned int txToLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
-{
- CAmount am(amount);
- UTXO *spentOutputs = nullptr;
- unsigned int spentOutputsLen = 0;
- return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, spentOutputs, spentOutputsLen, nIn, flags, err);
-}
-
-
-int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
- const unsigned char *txTo , unsigned int txToLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err)
-{
- if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
- return set_error(err, bitcoinconsensus_ERR_AMOUNT_REQUIRED);
- }
-
- CAmount am(0);
- UTXO *spentOutputs = nullptr;
- unsigned int spentOutputsLen = 0;
- return ::verify_script(scriptPubKey, scriptPubKeyLen, am, txTo, txToLen, spentOutputs, spentOutputsLen, nIn, flags, err);
-}
-
-unsigned int bitcoinconsensus_version()
-{
- // Just use the API version for now
- return BITCOINCONSENSUS_API_VER;
-}
diff --git a/src/script/bitcoinconsensus.h b/src/script/bitcoinconsensus.h
deleted file mode 100644
index a202b5ba06..0000000000
--- a/src/script/bitcoinconsensus.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2021 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_SCRIPT_BITCOINCONSENSUS_H
-#define BITCOIN_SCRIPT_BITCOINCONSENSUS_H
-
-#include <stdint.h>
-
-#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
- #if defined(_WIN32)
- #if defined(HAVE_DLLEXPORT_ATTRIBUTE)
- #define EXPORT_SYMBOL __declspec(dllexport)
- #else
- #define EXPORT_SYMBOL
- #endif
- #elif defined(HAVE_DEFAULT_VISIBILITY_ATTRIBUTE)
- #define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
- #endif
-#elif defined(MSC_VER) && !defined(STATIC_LIBBITCOINCONSENSUS)
- #define EXPORT_SYMBOL __declspec(dllimport)
-#endif
-
-#ifndef EXPORT_SYMBOL
- #define EXPORT_SYMBOL
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define BITCOINCONSENSUS_API_VER 2
-
-typedef enum bitcoinconsensus_error_t
-{
- bitcoinconsensus_ERR_OK = 0,
- bitcoinconsensus_ERR_TX_INDEX,
- bitcoinconsensus_ERR_TX_SIZE_MISMATCH,
- bitcoinconsensus_ERR_TX_DESERIALIZE,
- bitcoinconsensus_ERR_AMOUNT_REQUIRED,
- bitcoinconsensus_ERR_INVALID_FLAGS,
- bitcoinconsensus_ERR_SPENT_OUTPUTS_REQUIRED,
- bitcoinconsensus_ERR_SPENT_OUTPUTS_MISMATCH
-} bitcoinconsensus_error;
-
-/** Script verification flags */
-enum
-{
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE = 0,
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH = (1U << 0), // evaluate P2SH (BIP16) subscripts
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG = (1U << 2), // enforce strict DER (BIP66) compliance
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY = (1U << 4), // enforce NULLDUMMY (BIP147)
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), // enable CHECKLOCKTIMEVERIFY (BIP65)
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY = (1U << 10), // enable CHECKSEQUENCEVERIFY (BIP112)
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS = (1U << 11), // enable WITNESS (BIP141)
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_TAPROOT = (1U << 17), // enable TAPROOT (BIPs 341 & 342)
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL = bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH | bitcoinconsensus_SCRIPT_FLAGS_VERIFY_DERSIG |
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NULLDUMMY | bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKLOCKTIMEVERIFY |
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_CHECKSEQUENCEVERIFY | bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS |
- bitcoinconsensus_SCRIPT_FLAGS_VERIFY_TAPROOT
-};
-
-typedef struct {
- const unsigned char *scriptPubKey;
- unsigned int scriptPubKeySize;
- int64_t value;
-} UTXO;
-
-/// Returns 1 if the input nIn of the serialized transaction pointed to by
-/// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under
-/// the additional constraints specified by flags.
-/// If not nullptr, err will contain an error/success code for the operation
-EXPORT_SYMBOL int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
- const unsigned char *txTo , unsigned int txToLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err);
-
-EXPORT_SYMBOL int bitcoinconsensus_verify_script_with_amount(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
- const unsigned char *txTo , unsigned int txToLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err);
-
-EXPORT_SYMBOL int bitcoinconsensus_verify_script_with_spent_outputs(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount,
- const unsigned char *txTo , unsigned int txToLen,
- const UTXO *spentOutputs, unsigned int spentOutputsLen,
- unsigned int nIn, unsigned int flags, bitcoinconsensus_error* err);
-
-EXPORT_SYMBOL unsigned int bitcoinconsensus_version();
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#undef EXPORT_SYMBOL
-
-#endif // BITCOIN_SCRIPT_BITCOINCONSENSUS_H
diff --git a/src/script/miniscript.h b/src/script/miniscript.h
index 76b952350b..f635fa7340 100644
--- a/src/script/miniscript.h
+++ b/src/script/miniscript.h
@@ -1617,7 +1617,7 @@ public:
//! Produce a witness for this script, if possible and given the information available in the context.
//! The non-malleable satisfaction is guaranteed to be valid if it exists, and ValidSatisfaction()
//! is true. If IsSane() holds, this satisfaction is guaranteed to succeed in case the node's
- //! conditions are satisfied (private keys and hash preimages available, locktimes satsified).
+ //! conditions are satisfied (private keys and hash preimages available, locktimes satisfied).
template<typename Ctx>
Availability Satisfy(const Ctx& ctx, std::vector<std::vector<unsigned char>>& stack, bool nonmalleable = true) const {
auto ret = ProduceInput(ctx);
diff --git a/src/test/fuzz/script_bitcoin_consensus.cpp b/src/test/fuzz/script_bitcoin_consensus.cpp
deleted file mode 100644
index 846389863d..0000000000
--- a/src/test/fuzz/script_bitcoin_consensus.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2020 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include <script/bitcoinconsensus.h>
-#include <script/interpreter.h>
-#include <test/fuzz/FuzzedDataProvider.h>
-#include <test/fuzz/fuzz.h>
-#include <test/fuzz/util.h>
-
-#include <cstdint>
-#include <string>
-#include <vector>
-
-FUZZ_TARGET(script_bitcoin_consensus)
-{
- FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
- const std::vector<uint8_t> random_bytes_1 = ConsumeRandomLengthByteVector(fuzzed_data_provider);
- const std::vector<uint8_t> random_bytes_2 = ConsumeRandomLengthByteVector(fuzzed_data_provider);
- const CAmount money = ConsumeMoney(fuzzed_data_provider);
- bitcoinconsensus_error err;
- bitcoinconsensus_error* err_p = fuzzed_data_provider.ConsumeBool() ? &err : nullptr;
- const unsigned int n_in = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
- const unsigned int flags = fuzzed_data_provider.ConsumeIntegral<unsigned int>();
- assert(bitcoinconsensus_version() == BITCOINCONSENSUS_API_VER);
- if ((flags & SCRIPT_VERIFY_WITNESS) != 0 && (flags & SCRIPT_VERIFY_P2SH) == 0) {
- return;
- }
- (void)bitcoinconsensus_verify_script(random_bytes_1.data(), random_bytes_1.size(), random_bytes_2.data(), random_bytes_2.size(), n_in, flags, err_p);
- (void)bitcoinconsensus_verify_script_with_amount(random_bytes_1.data(), random_bytes_1.size(), money, random_bytes_2.data(), random_bytes_2.size(), n_in, flags, err_p);
-
- std::vector<UTXO> spent_outputs;
- std::vector<std::vector<unsigned char>> spent_spks;
- if (n_in <= 24386) {
- spent_outputs.reserve(n_in);
- spent_spks.reserve(n_in);
- for (size_t i = 0; i < n_in; ++i) {
- spent_spks.push_back(ConsumeRandomLengthByteVector(fuzzed_data_provider));
- const CAmount value{ConsumeMoney(fuzzed_data_provider)};
- const auto spk_size{static_cast<unsigned>(spent_spks.back().size())};
- spent_outputs.push_back({.scriptPubKey = spent_spks.back().data(), .scriptPubKeySize = spk_size, .value = value});
- }
- }
-
- const auto spent_outs_size{static_cast<unsigned>(spent_outputs.size())};
-
- (void)bitcoinconsensus_verify_script_with_spent_outputs(
- random_bytes_1.data(), random_bytes_1.size(), money, random_bytes_2.data(), random_bytes_2.size(),
- spent_outputs.data(), spent_outs_size, n_in, flags, err_p);
-}
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index ac457d9c77..0af2fdce08 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -2,10 +2,6 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
-
#include <test/data/script_tests.json.h>
#include <test/data/bip341_wallet_vectors.json.h>
@@ -27,10 +23,6 @@
#include <util/fs.h>
#include <util/strencodings.h>
-#if defined(HAVE_CONSENSUS_LIB)
-#include <script/bitcoinconsensus.h>
-#endif
-
#include <cstdint>
#include <fstream>
#include <string>
@@ -143,21 +135,6 @@ void DoTest(const CScript& scriptPubKey, const CScript& scriptSig, const CScript
if (combined_flags & SCRIPT_VERIFY_WITNESS && ~combined_flags & SCRIPT_VERIFY_P2SH) continue;
BOOST_CHECK_MESSAGE(VerifyScript(scriptSig, scriptPubKey, &scriptWitness, combined_flags, MutableTransactionSignatureChecker(&tx, 0, txCredit.vout[0].nValue, MissingDataBehavior::ASSERT_FAIL), &err) == expect, message + strprintf(" (with flags %x)", combined_flags));
}
-
-#if defined(HAVE_CONSENSUS_LIB)
- DataStream stream;
- stream << TX_WITH_WITNESS(tx2);
- uint32_t libconsensus_flags{flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL};
- if (libconsensus_flags == flags) {
- int expectedSuccessCode = expect ? 1 : 0;
- if (flags & bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS) {
- BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), txCredit.vout[0].nValue, UCharCast(stream.data()), stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
- } else {
- BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), 0, UCharCast(stream.data()), stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
- BOOST_CHECK_MESSAGE(bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), 0, libconsensus_flags, nullptr) == expectedSuccessCode, message);
- }
- }
-#endif
}
void static NegateSignatureS(std::vector<unsigned char>& vchSig) {
@@ -1498,179 +1475,6 @@ static CScriptWitness ScriptWitnessFromJSON(const UniValue& univalue)
return scriptwitness;
}
-#if defined(HAVE_CONSENSUS_LIB)
-
-/* Test simple (successful) usage of bitcoinconsensus_verify_script */
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_returns_true)
-{
- unsigned int libconsensus_flags = 0;
- int nIn = 0;
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_1;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << TX_WITH_WITNESS(spendTx);
-
- bitcoinconsensus_error err;
- int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 1);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_OK);
-}
-
-/* Test bitcoinconsensus_verify_script returns invalid tx index err*/
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_tx_index_err)
-{
- unsigned int libconsensus_flags = 0;
- int nIn = 3;
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_EQUAL;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << TX_WITH_WITNESS(spendTx);
-
- bitcoinconsensus_error err;
- int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_TX_INDEX);
-}
-
-/* Test bitcoinconsensus_verify_script returns tx size mismatch err*/
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_tx_size)
-{
- unsigned int libconsensus_flags = 0;
- int nIn = 0;
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_EQUAL;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << TX_WITH_WITNESS(spendTx);
-
- bitcoinconsensus_error err;
- int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size() * 2, nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_TX_SIZE_MISMATCH);
-}
-
-/* Test bitcoinconsensus_verify_script returns invalid tx serialization error */
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_tx_serialization)
-{
- unsigned int libconsensus_flags = 0;
- int nIn = 0;
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_EQUAL;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << 0xffffffff;
-
- bitcoinconsensus_error err;
- int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_TX_DESERIALIZE);
-}
-
-/* Test bitcoinconsensus_verify_script returns amount required error */
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_amount_required_err)
-{
- unsigned int libconsensus_flags = bitcoinconsensus_SCRIPT_FLAGS_VERIFY_WITNESS;
- int nIn = 0;
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_EQUAL;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << TX_WITH_WITNESS(spendTx);
-
- bitcoinconsensus_error err;
- int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_AMOUNT_REQUIRED);
-}
-
-/* Test bitcoinconsensus_verify_script returns invalid flags err */
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_invalid_flags)
-{
- unsigned int libconsensus_flags = 1 << 3;
- int nIn = 0;
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_EQUAL;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << TX_WITH_WITNESS(spendTx);
-
- bitcoinconsensus_error err;
- int result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_INVALID_FLAGS);
-}
-
-/* Test bitcoinconsensus_verify_script returns spent outputs required err */
-BOOST_AUTO_TEST_CASE(bitcoinconsensus_verify_script_spent_outputs_required_err)
-{
- unsigned int libconsensus_flags{bitcoinconsensus_SCRIPT_FLAGS_VERIFY_TAPROOT};
- const int nIn{0};
-
- CScript scriptPubKey;
- CScript scriptSig;
- CScriptWitness wit;
-
- scriptPubKey << OP_EQUAL;
- CTransaction creditTx{BuildCreditingTransaction(scriptPubKey, 1)};
- CTransaction spendTx{BuildSpendingTransaction(scriptSig, wit, creditTx)};
-
- DataStream stream;
- stream << TX_WITH_WITNESS(spendTx);
-
- bitcoinconsensus_error err;
- int result{bitcoinconsensus_verify_script_with_spent_outputs(scriptPubKey.data(), scriptPubKey.size(), creditTx.vout[0].nValue, UCharCast(stream.data()), stream.size(), nullptr, 0, nIn, libconsensus_flags, &err)};
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_SPENT_OUTPUTS_REQUIRED);
-
- result = bitcoinconsensus_verify_script_with_amount(scriptPubKey.data(), scriptPubKey.size(), creditTx.vout[0].nValue, UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_SPENT_OUTPUTS_REQUIRED);
-
- result = bitcoinconsensus_verify_script(scriptPubKey.data(), scriptPubKey.size(), UCharCast(stream.data()), stream.size(), nIn, libconsensus_flags, &err);
- BOOST_CHECK_EQUAL(result, 0);
- BOOST_CHECK_EQUAL(err, bitcoinconsensus_ERR_SPENT_OUTPUTS_REQUIRED);
-}
-
-#endif // defined(HAVE_CONSENSUS_LIB)
-
static std::vector<unsigned int> AllConsensusFlags()
{
std::vector<unsigned int> ret;
@@ -1718,28 +1522,12 @@ static void AssetTest(const UniValue& test)
txdata.Init(tx, std::vector<CTxOut>(prevouts));
CachingTransactionSignatureChecker txcheck(&tx, idx, prevouts[idx].nValue, true, txdata);
-#if defined(HAVE_CONSENSUS_LIB)
- DataStream stream;
- stream << TX_WITH_WITNESS(tx);
- std::vector<UTXO> utxos;
- utxos.resize(prevouts.size());
- for (size_t i = 0; i < prevouts.size(); i++) {
- utxos[i].scriptPubKey = prevouts[i].scriptPubKey.data();
- utxos[i].scriptPubKeySize = prevouts[i].scriptPubKey.size();
- utxos[i].value = prevouts[i].nValue;
- }
-#endif
-
for (const auto flags : ALL_CONSENSUS_FLAGS) {
// "final": true tests are valid for all flags. Others are only valid with flags that are
// a subset of test_flags.
if (fin || ((flags & test_flags) == flags)) {
bool ret = VerifyScript(tx.vin[idx].scriptSig, prevouts[idx].scriptPubKey, &tx.vin[idx].scriptWitness, flags, txcheck, nullptr);
BOOST_CHECK(ret);
-#if defined(HAVE_CONSENSUS_LIB)
- int lib_ret = bitcoinconsensus_verify_script_with_spent_outputs(prevouts[idx].scriptPubKey.data(), prevouts[idx].scriptPubKey.size(), prevouts[idx].nValue, UCharCast(stream.data()), stream.size(), utxos.data(), utxos.size(), idx, flags, nullptr);
- BOOST_CHECK(lib_ret == 1);
-#endif
}
}
}
@@ -1752,27 +1540,11 @@ static void AssetTest(const UniValue& test)
txdata.Init(tx, std::vector<CTxOut>(prevouts));
CachingTransactionSignatureChecker txcheck(&tx, idx, prevouts[idx].nValue, true, txdata);
-#if defined(HAVE_CONSENSUS_LIB)
- DataStream stream;
- stream << TX_WITH_WITNESS(tx);
- std::vector<UTXO> utxos;
- utxos.resize(prevouts.size());
- for (size_t i = 0; i < prevouts.size(); i++) {
- utxos[i].scriptPubKey = prevouts[i].scriptPubKey.data();
- utxos[i].scriptPubKeySize = prevouts[i].scriptPubKey.size();
- utxos[i].value = prevouts[i].nValue;
- }
-#endif
-
for (const auto flags : ALL_CONSENSUS_FLAGS) {
// If a test is supposed to fail with test_flags, it should also fail with any superset thereof.
if ((flags & test_flags) == test_flags) {
bool ret = VerifyScript(tx.vin[idx].scriptSig, prevouts[idx].scriptPubKey, &tx.vin[idx].scriptWitness, flags, txcheck, nullptr);
BOOST_CHECK(!ret);
-#if defined(HAVE_CONSENSUS_LIB)
- int lib_ret = bitcoinconsensus_verify_script_with_spent_outputs(prevouts[idx].scriptPubKey.data(), prevouts[idx].scriptPubKey.size(), prevouts[idx].nValue, UCharCast(stream.data()), stream.size(), utxos.data(), utxos.size(), idx, flags, nullptr);
- BOOST_CHECK(lib_ret == 0);
-#endif
}
}
}
diff --git a/src/validation.cpp b/src/validation.cpp
index 5c585438d1..8a78f2106d 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -5784,7 +5784,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot(
CBlockIndex* index = nullptr;
// Don't make any modifications to the genesis block since it shouldn't be
- // neccessary, and since the genesis block doesn't have normal flags like
+ // necessary, and since the genesis block doesn't have normal flags like
// BLOCK_VALID_SCRIPTS set.
constexpr int AFTER_GENESIS_START{1};
diff --git a/src/validation.h b/src/validation.h
index de81058033..e3b2a2d59b 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -275,7 +275,7 @@ MempoolAcceptResult AcceptToMemoryPool(Chainstate& active_chainstate, const CTra
* Validate (and maybe submit) a package to the mempool. See doc/policy/packages.md for full details
* on package validation rules.
* @param[in] test_accept When true, run validation checks but don't submit to mempool.
-* @param[in] client_maxfeerate If exceeded by an individual transaction, rest of (sub)package evalution is aborted.
+* @param[in] client_maxfeerate If exceeded by an individual transaction, rest of (sub)package evaluation is aborted.
* Only for sanity checks against local submission of transactions.
* @returns a PackageMempoolAcceptResult which includes a MempoolAcceptResult for each transaction.
* If a transaction fails, validation will exit early and some results may be missing. It is also
@@ -478,7 +478,7 @@ enum class CoinsCacheSizeState
* current best chain.
*
* Eventually, the API here is targeted at being exposed externally as a
- * consumable libconsensus library, so any functions added must only call
+ * consumable library, so any functions added must only call
* other class member functions, pure functions in other parts of the consensus
* library, callbacks via the validation interface, or read/write-to-disk
* functions (eventually this will also be via callbacks).
diff --git a/test/functional/feature_assumevalid.py b/test/functional/feature_assumevalid.py
index 613d2eab14..982fa79915 100755
--- a/test/functional/feature_assumevalid.py
+++ b/test/functional/feature_assumevalid.py
@@ -159,7 +159,7 @@ class AssumeValidTest(BitcoinTestFramework):
for i in range(2202):
p2p1.send_message(msg_block(self.blocks[i]))
# Syncing 2200 blocks can take a while on slow systems. Give it plenty of time to sync.
- p2p1.sync_with_ping(960)
+ p2p1.sync_with_ping(timeout=960)
assert_equal(self.nodes[1].getblock(self.nodes[1].getbestblockhash())['height'], 2202)
p2p2 = self.nodes[2].add_p2p_connection(BaseNode())
diff --git a/test/functional/p2p_block_sync.py b/test/functional/p2p_block_sync.py
index d821edc1b1..6c7f08364e 100755
--- a/test/functional/p2p_block_sync.py
+++ b/test/functional/p2p_block_sync.py
@@ -22,7 +22,7 @@ class BlockSyncTest(BitcoinTestFramework):
# node0 -> node1 -> node2
# So node1 has both an inbound and outbound peer.
# In our test, we will mine a block on node0, and ensure that it makes
- # to to both node1 and node2.
+ # to both node1 and node2.
self.connect_nodes(0, 1)
self.connect_nodes(1, 2)
diff --git a/test/functional/p2p_compactblocks.py b/test/functional/p2p_compactblocks.py
index d6c06fdeed..0950579580 100755
--- a/test/functional/p2p_compactblocks.py
+++ b/test/functional/p2p_compactblocks.py
@@ -139,7 +139,7 @@ class TestP2PConn(P2PInterface):
This is used when we want to send a message into the node that we expect
will get us disconnected, eg an invalid block."""
self.send_message(message)
- self.wait_for_disconnect(timeout)
+ self.wait_for_disconnect(timeout=timeout)
class CompactBlocksTest(BitcoinTestFramework):
def set_test_params(self):
diff --git a/test/functional/p2p_node_network_limited.py b/test/functional/p2p_node_network_limited.py
index 467bbad09c..8b63d8ee26 100755
--- a/test/functional/p2p_node_network_limited.py
+++ b/test/functional/p2p_node_network_limited.py
@@ -92,7 +92,8 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
# Wait until the full_node is headers-wise sync
best_block_hash = pruned_node.getbestblockhash()
- self.wait_until(lambda: next(filter(lambda x: x['hash'] == best_block_hash, full_node.getchaintips()))['status'] == "headers-only")
+ default_value = {'status': ''} # No status
+ self.wait_until(lambda: next(filter(lambda x: x['hash'] == best_block_hash, full_node.getchaintips()), default_value)['status'] == "headers-only")
# Now, since the node aims to download a window of 1024 blocks,
# ensure it requests the blocks below the threshold only (with a
@@ -137,7 +138,7 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
self.log.info("Requesting block at height 2 (tip-289) must fail (ignored).")
node.send_getdata_for_block(blocks[0]) # first block outside of the 288+2 limit
- node.wait_for_disconnect(5)
+ node.wait_for_disconnect(timeout=5)
self.nodes[0].disconnect_p2ps()
# connect unsynced node 2 with pruned NODE_NETWORK_LIMITED peer
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index 1c0c11d74c..af47c6d9f0 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -198,15 +198,15 @@ class TestP2PConn(P2PInterface):
self.send_message(msg)
else:
self.send_message(msg_inv(inv=[CInv(MSG_BLOCK, block.sha256)]))
- self.wait_for_getheaders()
+ self.wait_for_getheaders(timeout=timeout)
self.send_message(msg)
- self.wait_for_getdata([block.sha256])
+ self.wait_for_getdata([block.sha256], timeout=timeout)
def request_block(self, blockhash, inv_type, timeout=60):
with p2p_lock:
self.last_message.pop("block", None)
self.send_message(msg_getdata(inv=[CInv(inv_type, blockhash)]))
- self.wait_for_block(blockhash, timeout)
+ self.wait_for_block(blockhash, timeout=timeout)
return self.last_message["block"].block
class SegWitTest(BitcoinTestFramework):
@@ -2056,7 +2056,7 @@ class SegWitTest(BitcoinTestFramework):
test_transaction_acceptance(self.nodes[0], self.wtx_node, tx2, with_witness=True, accepted=False)
# Expect a request for parent (tx) by txid despite use of WTX peer
- self.wtx_node.wait_for_getdata([tx.sha256], 60)
+ self.wtx_node.wait_for_getdata([tx.sha256], timeout=60)
with p2p_lock:
lgd = self.wtx_node.lastgetdata[:]
assert_equal(lgd, [CInv(MSG_WITNESS_TX, tx.sha256)])
diff --git a/test/functional/test_framework/p2p.py b/test/functional/test_framework/p2p.py
index dc04696114..ce76008c46 100755
--- a/test/functional/test_framework/p2p.py
+++ b/test/functional/test_framework/p2p.py
@@ -585,22 +585,22 @@ class P2PInterface(P2PConnection):
wait_until_helper_internal(test_function, timeout=timeout, lock=p2p_lock, timeout_factor=self.timeout_factor)
- def wait_for_connect(self, timeout=60):
+ def wait_for_connect(self, *, timeout=60):
test_function = lambda: self.is_connected
self.wait_until(test_function, timeout=timeout, check_connected=False)
- def wait_for_disconnect(self, timeout=60):
+ def wait_for_disconnect(self, *, timeout=60):
test_function = lambda: not self.is_connected
self.wait_until(test_function, timeout=timeout, check_connected=False)
- def wait_for_reconnect(self, timeout=60):
+ def wait_for_reconnect(self, *, timeout=60):
def test_function():
return self.is_connected and self.last_message.get('version') and not self.supports_v2_p2p
self.wait_until(test_function, timeout=timeout, check_connected=False)
# Message receiving helper methods
- def wait_for_tx(self, txid, timeout=60):
+ def wait_for_tx(self, txid, *, timeout=60):
def test_function():
if not self.last_message.get('tx'):
return False
@@ -608,13 +608,13 @@ class P2PInterface(P2PConnection):
self.wait_until(test_function, timeout=timeout)
- def wait_for_block(self, blockhash, timeout=60):
+ def wait_for_block(self, blockhash, *, timeout=60):
def test_function():
return self.last_message.get("block") and self.last_message["block"].block.rehash() == blockhash
self.wait_until(test_function, timeout=timeout)
- def wait_for_header(self, blockhash, timeout=60):
+ def wait_for_header(self, blockhash, *, timeout=60):
def test_function():
last_headers = self.last_message.get('headers')
if not last_headers:
@@ -623,7 +623,7 @@ class P2PInterface(P2PConnection):
self.wait_until(test_function, timeout=timeout)
- def wait_for_merkleblock(self, blockhash, timeout=60):
+ def wait_for_merkleblock(self, blockhash, *, timeout=60):
def test_function():
last_filtered_block = self.last_message.get('merkleblock')
if not last_filtered_block:
@@ -632,7 +632,7 @@ class P2PInterface(P2PConnection):
self.wait_until(test_function, timeout=timeout)
- def wait_for_getdata(self, hash_list, timeout=60):
+ def wait_for_getdata(self, hash_list, *, timeout=60):
"""Waits for a getdata message.
The object hashes in the inventory vector must match the provided hash_list."""
@@ -644,7 +644,7 @@ class P2PInterface(P2PConnection):
self.wait_until(test_function, timeout=timeout)
- def wait_for_getheaders(self, timeout=60):
+ def wait_for_getheaders(self, *, timeout=60):
"""Waits for a getheaders message.
Receiving any getheaders message will satisfy the predicate. the last_message["getheaders"]
@@ -656,7 +656,7 @@ class P2PInterface(P2PConnection):
self.wait_until(test_function, timeout=timeout)
- def wait_for_inv(self, expected_inv, timeout=60):
+ def wait_for_inv(self, expected_inv, *, timeout=60):
"""Waits for an INV message and checks that the first inv object in the message was as expected."""
if len(expected_inv) > 1:
raise NotImplementedError("wait_for_inv() will only verify the first inv object")
@@ -668,7 +668,7 @@ class P2PInterface(P2PConnection):
self.wait_until(test_function, timeout=timeout)
- def wait_for_verack(self, timeout=60):
+ def wait_for_verack(self, *, timeout=60):
def test_function():
return "verack" in self.last_message
@@ -681,11 +681,11 @@ class P2PInterface(P2PConnection):
self.send_message(self.on_connection_send_msg)
self.on_connection_send_msg = None # Never used again
- def send_and_ping(self, message, timeout=60):
+ def send_and_ping(self, message, *, timeout=60):
self.send_message(message)
self.sync_with_ping(timeout=timeout)
- def sync_with_ping(self, timeout=60):
+ def sync_with_ping(self, *, timeout=60):
"""Ensure ProcessMessages and SendMessages is called on this connection"""
# Sending two pings back-to-back, requires that the node calls
# `ProcessMessage` twice, and thus ensures `SendMessages` must have
@@ -726,7 +726,7 @@ class NetworkThread(threading.Thread):
"""Start the network thread."""
self.network_event_loop.run_forever()
- def close(self, timeout=10):
+ def close(self, *, timeout=10):
"""Close the connections and network event loop."""
self.network_event_loop.call_soon_threadsafe(self.network_event_loop.stop)
wait_until_helper_internal(lambda: not self.network_event_loop.is_running(), timeout=timeout)
@@ -933,7 +933,7 @@ class P2PTxInvStore(P2PInterface):
with p2p_lock:
return list(self.tx_invs_received.keys())
- def wait_for_broadcast(self, txns, timeout=60):
+ def wait_for_broadcast(self, txns, *, timeout=60):
"""Waits for the txns (list of txids) to complete initial broadcast.
The mempool should mark unbroadcast=False for these transactions.
"""