aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml2
-rwxr-xr-xci/test/00_setup_env_native_valgrind.sh4
-rwxr-xr-xci/test/00_setup_env_s390x.sh2
-rw-r--r--configure.ac7
-rw-r--r--contrib/macdeploy/README.md18
-rw-r--r--contrib/valgrind.supp21
-rw-r--r--depends/Makefile4
-rw-r--r--depends/README.md4
-rw-r--r--depends/builders/default.mk3
-rw-r--r--depends/builders/openbsd.mk7
-rw-r--r--depends/funcs.mk6
-rw-r--r--depends/hosts/openbsd.mk31
-rw-r--r--depends/packages/bdb.mk1
-rw-r--r--depends/packages/boost.mk3
-rw-r--r--depends/packages/libevent.mk1
-rw-r--r--depends/packages/native_clang.mk2
-rw-r--r--depends/packages/native_libtapi.mk1
-rw-r--r--depends/packages/qt.mk6
-rw-r--r--depends/packages/sqlite.mk1
-rw-r--r--depends/packages/zeromq.mk1
-rw-r--r--depends/patches/boost/fix_openbsd_test_lib.patch38
-rw-r--r--doc/descriptors.md4
-rw-r--r--doc/release-process.md2
-rw-r--r--share/setup.nsi.in10
-rw-r--r--src/init.cpp2
-rw-r--r--src/qt/qvalidatedlineedit.cpp9
-rw-r--r--src/qt/qvalidatedlineedit.h1
-rw-r--r--src/random.cpp20
-rw-r--r--src/script/script.h4
-rw-r--r--src/streams.h67
-rw-r--r--src/test/coins_tests.cpp6
-rw-r--r--src/test/fuzz/coins_view.cpp2
-rw-r--r--src/test/fuzz/string.cpp3
-rw-r--r--src/test/getarg_tests.cpp92
-rw-r--r--src/test/serialize_tests.cpp45
-rw-r--r--src/test/streams_tests.cpp43
-rw-r--r--src/util/strencodings.cpp3
-rw-r--r--src/util/system.cpp54
-rw-r--r--src/util/system.h16
-rw-r--r--src/validation.cpp8
-rw-r--r--src/validation.h17
-rw-r--r--src/wallet/load.cpp2
-rw-r--r--src/wallet/rpc/wallet.cpp2
-rw-r--r--src/wallet/test/init_tests.cpp8
-rw-r--r--src/wallet/walletutil.cpp2
-rwxr-xr-xtest/functional/feature_syscall_sandbox.py2
-rw-r--r--test/functional/test_framework/util.py11
-rwxr-xr-xtest/functional/test_runner.py6
-rwxr-xr-xtest/functional/wallet_send.py9
-rwxr-xr-xtest/functional/wallet_signer.py2
-rw-r--r--test/sanitizer_suppressions/ubsan5
51 files changed, 342 insertions, 278 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index fec4975080..5624c97d56 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -286,7 +286,7 @@ task:
brew_install_script:
- brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
<< : *GLOBAL_TASK_TEMPLATE
- osx_instance:
+ macos_instance:
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
image: monterey-xcode-13.2 # https://cirrus-ci.org/guide/macOS
env:
diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh
index b0852f52a7..90ea368df9 100755
--- a/ci/test/00_setup_env_native_valgrind.sh
+++ b/ci/test/00_setup_env_native_valgrind.sh
@@ -6,11 +6,11 @@
export LC_ALL=C.UTF-8
-export DOCKER_NAME_TAG="ubuntu:20.04"
+export DOCKER_NAME_TAG="ubuntu:22.04"
export CONTAINER_NAME=ci_native_valgrind
export PACKAGES="valgrind clang llvm python3-zmq libevent-dev bsdmainutils libboost-dev libboost-test-dev libdb5.3++-dev libminiupnpc-dev libnatpmp-dev libzmq3-dev libsqlite3-dev"
export USE_VALGRIND=1
export NO_DEPENDS=1
-export TEST_RUNNER_EXTRA="--nosandbox --exclude rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
+export TEST_RUNNER_EXTRA="--nosandbox --exclude feature_init,rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
export GOAL="install"
export BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=no CC=clang CXX=clang++" # TODO enable GUI
diff --git a/ci/test/00_setup_env_s390x.sh b/ci/test/00_setup_env_s390x.sh
index 0ec557ee46..136edb6662 100755
--- a/ci/test/00_setup_env_s390x.sh
+++ b/ci/test/00_setup_env_s390x.sh
@@ -20,7 +20,7 @@ fi
export CONTAINER_NAME=ci_s390x
export DOCKER_NAME_TAG="debian:bookworm"
export TEST_RUNNER_ENV="LC_ALL=C"
-export TEST_RUNNER_EXTRA="--exclude rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
+export TEST_RUNNER_EXTRA="--exclude feature_init,rpc_bind,feature_bind_extra" # Excluded for now, see https://github.com/bitcoin/bitcoin/issues/17765#issuecomment-602068547
export RUN_FUNCTIONAL_TESTS=true
export GOAL="install"
export BITCOIN_CONFIG="--enable-reduce-exports --disable-gui-tests" # GUI tests disabled for now, see https://github.com/bitcoin/bitcoin/issues/23730
diff --git a/configure.ac b/configure.ac
index 078e113e95..6b172959f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1112,13 +1112,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
[ AC_MSG_RESULT([no])]
)
-AC_MSG_CHECKING([for getentropy])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
- [[ getentropy(nullptr, 32) ]])],
- [ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GETENTROPY], [1], [Define this symbol if the BSD getentropy system call is available]) ],
- [ AC_MSG_RESULT([no])]
-)
-
AC_MSG_CHECKING([for getentropy via random.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
#include <sys/random.h>]],
diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md
index df7eac3ec8..ce69079e29 100644
--- a/contrib/macdeploy/README.md
+++ b/contrib/macdeploy/README.md
@@ -12,12 +12,14 @@ When complete, it will have produced `Bitcoin-Core.dmg`.
### Step 1: Obtaining `Xcode.app`
+A free Apple Developer Account is required to proceed.
+
Our current macOS SDK
(`Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz`) can be
extracted from
[Xcode_12.2.xip](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip).
Alternatively, after logging in to your account go to 'Downloads', then 'More'
-and look for [`Xcode_12.2`](https://download.developer.apple.com/Developer_Tools/Xcode_12.2/Xcode_12.2.xip).
+and search for [`Xcode_12.2`](https://developer.apple.com/download/all/?q=Xcode%2012.2).
An Apple ID and cookies enabled for the hostname are needed to download this.
The `sha256sum` of the archive should be `28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0`.
@@ -78,19 +80,9 @@ This version of `cctools` has been patched to use the current version of `clang`
and its `libLTO.so` rather than those from `llvmgcc`, as it was originally done in `toolchain4`.
To complicate things further, all builds must target an Apple SDK. These SDKs are free to
-download, but not redistributable. To obtain it, register for an Apple Developer Account,
-then download [Xcode_12.1](https://download.developer.apple.com/Developer_Tools/Xcode_12.1/Xcode_12.1.xip).
-
-This file is many gigabytes in size, but most (but not all) of what we need is
-contained only in a single directory:
-
-```bash
-Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
-```
-
-See the SDK Extraction notes above for how to obtain it.
+download, but not redistributable. See the SDK Extraction notes above for how to obtain it.
-The Guix process build 2 sets of files: Linux tools, then Apple binaries which are
+The Guix process builds 2 sets of files: Linux tools, then Apple binaries which are
created using these tools. The build process has been designed to avoid including the
SDK's files in Guix's outputs. All interim tarballs are fully deterministic and may be freely
redistributed.
diff --git a/contrib/valgrind.supp b/contrib/valgrind.supp
index 35f3d792ff..99ca305fe7 100644
--- a/contrib/valgrind.supp
+++ b/contrib/valgrind.supp
@@ -13,8 +13,8 @@
#
# Note that suppressions may depend on OS and/or library versions.
# Tested on:
-# * aarch64 (Ubuntu 20.04 system libs, without gui)
-# * x86_64 (Ubuntu 18.04 system libs, without gui)
+# * aarch64 (Ubuntu 22.04 system libs, clang, without gui)
+# * x86_64 (Ubuntu 22.04 system libs, clang, without gui)
{
Suppress libstdc++ warning - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65434
Memcheck:Leak
@@ -113,12 +113,6 @@
fun:GetCoin
}
{
- Suppress wcsnrtombs glibc SSE4 warning (could be related: https://stroika.atlassian.net/browse/STK-626)
- Memcheck:Addr16
- fun:__wcsnlen_sse4_1
- fun:wcsnrtombs
-}
-{
Suppress boost warning
Memcheck:Leak
fun:_Znwm
@@ -129,17 +123,6 @@
fun:main
}
{
- Suppress boost still reachable memory warning
- Memcheck:Leak
- match-leak-kinds: reachable
- fun:_Znwm
- ...
- fun:_M_construct_aux<char*>
- fun:_M_construct<char*>
- fun:basic_string
- fun:path
-}
-{
Suppress LogInstance still reachable memory warning
Memcheck:Leak
match-leak-kinds: reachable
diff --git a/depends/Makefile b/depends/Makefile
index 003778b375..573115d447 100644
--- a/depends/Makefile
+++ b/depends/Makefile
@@ -77,6 +77,7 @@ full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))
build_os:=$(findstring linux,$(full_build_os))
build_os+=$(findstring darwin,$(full_build_os))
build_os+=$(findstring freebsd,$(full_build_os))
+build_os+=$(findstring openbsd,$(full_build_os))
build_os:=$(strip $(build_os))
ifeq ($(build_os),)
build_os=$(full_build_os)
@@ -88,6 +89,7 @@ full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host))
host_os:=$(findstring linux,$(full_host_os))
host_os+=$(findstring darwin,$(full_host_os))
host_os+=$(findstring freebsd,$(full_host_os))
+host_os+=$(findstring openbsd,$(full_host_os))
host_os+=$(findstring mingw32,$(full_host_os))
ifeq (android,$(findstring android,$(full_host_os)))
@@ -182,7 +184,7 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
mkdir -p $(@D)
echo copying packages: $^
echo to: $(@D)
- cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
+ cd $(@D); $(foreach package,$^, $(build_TAR) xf $($(package)_cached); )
touch $@
# $PATH is not preserved between ./configure and make by convention. Its
diff --git a/depends/README.md b/depends/README.md
index 6b6af99dee..f7647198c6 100644
--- a/depends/README.md
+++ b/depends/README.md
@@ -84,6 +84,10 @@ For linux S390X cross compilation:
sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu
+### Install the required dependencies: OpenBSD
+
+ pkg_add bash gtar
+
### Dependency Options
The following can be set when running make: `make FOO=bar`
diff --git a/depends/builders/default.mk b/depends/builders/default.mk
index f097db65d6..0370fb9acb 100644
--- a/depends/builders/default.mk
+++ b/depends/builders/default.mk
@@ -1,6 +1,7 @@
default_build_CC = gcc
default_build_CXX = g++
default_build_AR = ar
+default_build_TAR = tar
default_build_RANLIB = ranlib
default_build_STRIP = strip
default_build_NM = nm
@@ -12,7 +13,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1)
build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1)
build_$1=$$(build_$(build_arch)_$(build_os)_$1)
endef
-$(foreach var,CC CXX AR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var))))
+$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var))))
define add_build_flags_func
build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1)
build_$1=$$(build_$(build_arch)_$(build_os)_$1)
diff --git a/depends/builders/openbsd.mk b/depends/builders/openbsd.mk
new file mode 100644
index 0000000000..44825d106a
--- /dev/null
+++ b/depends/builders/openbsd.mk
@@ -0,0 +1,7 @@
+build_openbsd_CC = clang
+build_openbsd_CXX = clang++
+
+build_openbsd_SHA256SUM = sha256
+build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
+
+build_openbsd_TAR = gtar
diff --git a/depends/funcs.mk b/depends/funcs.mk
index 453d92cfb2..c4ad109c69 100644
--- a/depends/funcs.mk
+++ b/depends/funcs.mk
@@ -84,7 +84,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
#default commands
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
-$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source)
+$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_TAR) --no-same-owner --strip-components=1 -xf $$($(1)_source)
$(1)_preprocess_cmds ?=
$(1)_build_cmds ?=
$(1)_config_cmds ?=
@@ -207,7 +207,7 @@ $($(1)_preprocessed): | $($(1)_extracted)
touch $$@
$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed)
echo Configuring $(1)...
- rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); )
+ rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), $(build_TAR) --no-same-owner -xf $($(package)_cached); )
mkdir -p $$(@D)
+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
touch $$@
@@ -228,7 +228,7 @@ $($(1)_postprocessed): | $($(1)_staged)
touch $$@
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
echo Caching $(1)...
- cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | tar --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T -
+ cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | $(build_TAR) --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T -
mkdir -p $$(@D)
rm -rf $$(@D) && mkdir -p $$(@D)
mv $$($(1)_staging_dir)/$$(@F) $$(@)
diff --git a/depends/hosts/openbsd.mk b/depends/hosts/openbsd.mk
new file mode 100644
index 0000000000..dc8393e04c
--- /dev/null
+++ b/depends/hosts/openbsd.mk
@@ -0,0 +1,31 @@
+openbsd_CFLAGS=-pipe
+openbsd_CFLAGS_CXXFLAGS=$(openbsd_CFLAGS)
+
+openbsd_CFLAGS_release_CFLAGS=-O2
+openbsd_CFLAGS_release_CXXFLAGS=$(openbsd_release_CFLAGS)
+
+openbsd_CFLAGS_debug_CFLAGS=-O1
+openbsd_CFLAGS_debug_CXXFLAGS=$(openbsd_debug_CFLAGS)
+
+ifeq (86,$(findstring 86,$(build_arch)))
+i686_openbsd_CC=clang -m32
+i686_openbsd_CXX=clang++ -m32
+i686_openbsd_AR=ar
+i686_openbsd_RANLIB=ranlib
+i686_openbsd_NM=nm
+i686_openbsd_STRIP=strip
+
+x86_64_openbsd_CC=clang -m64
+x86_64_openbsd_CXX=clang++ -m64
+x86_64_openbsd_AR=ar
+x86_64_openbsd_RANLIB=ranlib
+x86_64_openbsd_NM=nm
+x86_64_openbsd_STRIP=strip
+else
+i686_openbsd_CC=$(default_host_CC) -m32
+i686_openbsd_CXX=$(default_host_CXX) -m32
+x86_64_openbsd_CC=$(default_host_CC) -m64
+x86_64_openbsd_CXX=$(default_host_CXX) -m64
+endif
+
+openbsd_cmake_system=OpenBSD
diff --git a/depends/packages/bdb.mk b/depends/packages/bdb.mk
index 4e74c95a8e..95004f3a22 100644
--- a/depends/packages/bdb.mk
+++ b/depends/packages/bdb.mk
@@ -11,6 +11,7 @@ $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --ena
$(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
+$(package)_config_opts_openbsd=--with-pic
$(package)_config_opts_android=--with-pic
$(package)_cflags+=-Wno-error=implicit-function-declaration
$(package)_cxxflags+=-std=c++17
diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk
index 2a2ff525f7..3c849b1e8d 100644
--- a/depends/packages/boost.mk
+++ b/depends/packages/boost.mk
@@ -4,6 +4,7 @@ $(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$($(
$(package)_file_name=boost_$(subst .,_,$($(package)_version)).tar.bz2
$(package)_sha256_hash=d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee
$(package)_dependencies=native_b2
+$(package)_patches=fix_openbsd_test_lib.patch
define $(package)_set_vars
$(package)_config_opts_release=variant=release
@@ -26,11 +27,13 @@ $(package)_config_libraries=test
$(package)_cxxflags+=-std=c++17
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_freebsd=-fPIC
+$(package)_cxxflags_openbsd=-fPIC
$(package)_cxxflags_android=-fPIC
$(package)_cxxflags_x86_64=-fcf-protection=full
endef
define $(package)_preprocess_cmds
+ patch -p1 < $($(package)_patch_dir)/fix_openbsd_test_lib.patch && \
echo "using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : <cflags>\"$($(package)_cflags)\" <cxxflags>\"$($(package)_cxxflags)\" <compileflags>\"$($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$($(package)_ar)\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
endef
diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk
index 2305f96d27..78850e583e 100644
--- a/depends/packages/libevent.mk
+++ b/depends/packages/libevent.mk
@@ -13,6 +13,7 @@ define $(package)_set_vars
$(package)_config_opts_release=--disable-debug-mode
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
+ $(package)_config_opts_openbsd=--with-pic
$(package)_config_opts_android=--with-pic
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
endef
diff --git a/depends/packages/native_clang.mk b/depends/packages/native_clang.mk
index 25ac77c1a3..23c8139262 100644
--- a/depends/packages/native_clang.mk
+++ b/depends/packages/native_clang.mk
@@ -2,11 +2,9 @@ package=native_clang
$(package)_version=10.0.1
$(package)_download_path=https://github.com/llvm/llvm-project/releases/download/llvmorg-$($(package)_version)
ifneq (,$(findstring aarch64,$(BUILD)))
-$(package)_download_file=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_file_name=clang+llvm-$($(package)_version)-aarch64-linux-gnu.tar.xz
$(package)_sha256_hash=90dc69a4758ca15cd0ffa45d07fbf5bf4309d47d2c7745a9f0735ecffde9c31f
else
-$(package)_download_file=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_file_name=clang+llvm-$($(package)_version)-x86_64-linux-gnu-ubuntu-16.04.tar.xz
$(package)_sha256_hash=48b83ef827ac2c213d5b64f5ad7ed082c8bcb712b46644e0dc5045c6f462c231
endif
diff --git a/depends/packages/native_libtapi.mk b/depends/packages/native_libtapi.mk
index 60b898da5f..1633213a42 100644
--- a/depends/packages/native_libtapi.mk
+++ b/depends/packages/native_libtapi.mk
@@ -1,7 +1,6 @@
package=native_libtapi
$(package)_version=664b8414f89612f2dfd35a9b679c345aa5389026
$(package)_download_path=https://github.com/tpoechtrager/apple-libtapi/archive
-$(package)_download_file=$($(package)_version).tar.gz
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=62e419c12d1c9fad67cc1cd523132bc00db050998337c734c15bc8d73cc02b61
diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index 313b22218c..9cdfd21d2c 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -201,11 +201,11 @@ define $(package)_extract_cmds
echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
mkdir qtbase && \
- tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
+ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
mkdir qttranslations && \
- tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
+ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
mkdir qttools && \
- tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
+ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
endef
# Preprocessing steps work as follows:
diff --git a/depends/packages/sqlite.mk b/depends/packages/sqlite.mk
index 36b6df7f6e..94bc6dda79 100644
--- a/depends/packages/sqlite.mk
+++ b/depends/packages/sqlite.mk
@@ -8,6 +8,7 @@ define $(package)_set_vars
$(package)_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
+$(package)_config_opts_openbsd=--with-pic
endef
define $(package)_preprocess_cmds
diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk
index c56ec5c2bd..2d8286ea36 100644
--- a/depends/packages/zeromq.mk
+++ b/depends/packages/zeromq.mk
@@ -13,6 +13,7 @@ define $(package)_set_vars
$(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
+ $(package)_config_opts_openbsd=--with-pic
$(package)_config_opts_android=--with-pic
$(package)_cxxflags+=-std=c++17
endef
diff --git a/depends/patches/boost/fix_openbsd_test_lib.patch b/depends/patches/boost/fix_openbsd_test_lib.patch
new file mode 100644
index 0000000000..84351065a3
--- /dev/null
+++ b/depends/patches/boost/fix_openbsd_test_lib.patch
@@ -0,0 +1,38 @@
+commit 684f067dde3b798877655cdda4eab8d7c26b2510
+Author: George Koehler <kernigh@gmail.com>
+Date: Thu Oct 3 20:06:38 2019 -0400
+
+ OpenBSD is missing SI_ASYNCIO and SI_MESGQ
+
+ Check if SI_ASYNCIO and SI_MESGQ are defined as macros. This allows
+ to run tests on OpenBSD 6.5, where the macros are missing.
+
+ This is identical to patch-boost_test_impl_execution_monitor_ipp in
+ OpenBSD Ports, except that I added a comment.
+
+ Can be removed when we use Boost 1.72.x or later.
+
+diff --git a/boost/test/impl/execution_monitor.ipp b/boost/test/impl/execution_monitor.ipp
+index ccc44972..77a01e21 100644
+--- a/boost/test/impl/execution_monitor.ipp
++++ b/boost/test/impl/execution_monitor.ipp
+@@ -391,14 +391,19 @@ system_signal_exception::report() const
+ report_error( execution_exception::system_error,
+ "signal: the expiration of a timer set by timer_settimer()" );
+ break;
++// OpenBSD was missing SI_ASYNCIO and SI_MESGQ
++#ifdef SI_ASYNCIO
+ case SI_ASYNCIO:
+ report_error( execution_exception::system_error,
+ "signal: generated by the completion of an asynchronous I/O request" );
+ break;
++#endif
++#ifdef SI_MESGQ
+ case SI_MESGQ:
+ report_error( execution_exception::system_error,
+ "signal: generated by the the arrival of a message on an empty message queue" );
+ break;
++#endif
+ default:
+ break;
+ }
diff --git a/doc/descriptors.md b/doc/descriptors.md
index 57a0f99d70..318d065fdb 100644
--- a/doc/descriptors.md
+++ b/doc/descriptors.md
@@ -90,12 +90,12 @@ Descriptors consist of several types of expressions. The top level expression is
- Optionally followed by a single `/*` or `/*'` final step to denote all (direct) unhardened or hardened children.
- The usage of hardened derivation steps requires providing the private key.
+(Anywhere a `'` suffix is permitted to denote hardened derivation, the suffix `h` can be used instead.)
+
`TREE` expressions:
- any `SCRIPT` expression
- An open brace `{`, a `TREE` expression, a comma `,`, a `TREE` expression, and a closing brace `}`
-(Anywhere a `'` suffix is permitted to denote hardened derivation, the suffix `h` can be used instead.)
-
`ADDR` expressions are any type of supported address:
- P2PKH addresses (base58, of the form `1...` for mainnet or `[nm]...` for testnet). Note that P2PKH addresses in descriptors cannot be used for P2PK outputs (use the `pk` function instead).
- P2SH addresses (base58, of the form `3...` for mainnet or `2...` for testnet, defined in [BIP 13](https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki)).
diff --git a/doc/release-process.md b/doc/release-process.md
index f786b345b1..742d349c17 100644
--- a/doc/release-process.md
+++ b/doc/release-process.md
@@ -97,7 +97,7 @@ Checkout the Bitcoin Core version you'd like to build:
pushd ./bitcoin
SIGNER='(your builder key, ie bluematt, sipa, etc)'
VERSION='(new version without v-prefix, e.g. 0.20.0)'
-git fetch "v${VERSION}"
+git fetch origin "v${VERSION}"
git checkout "v${VERSION}"
popd
```
diff --git a/share/setup.nsi.in b/share/setup.nsi.in
index c7b149345c..b31ba7a5b4 100644
--- a/share/setup.nsi.in
+++ b/share/setup.nsi.in
@@ -72,14 +72,14 @@ ShowUninstDetails show
Section -Main SEC0000
SetOutPath $INSTDIR
SetOverwrite on
- File @abs_top_srcdir@/release/@BITCOIN_GUI_NAME@@EXEEXT@
+ File @abs_top_builddir@/release/@BITCOIN_GUI_NAME@@EXEEXT@
File /oname=COPYING.txt @abs_top_srcdir@/COPYING
File /oname=readme.txt @abs_top_srcdir@/doc/README_windows.txt
SetOutPath $INSTDIR\daemon
- File @abs_top_srcdir@/release/@BITCOIN_DAEMON_NAME@@EXEEXT@
- File @abs_top_srcdir@/release/@BITCOIN_CLI_NAME@@EXEEXT@
- File @abs_top_srcdir@/release/@BITCOIN_TX_NAME@@EXEEXT@
- File @abs_top_srcdir@/release/@BITCOIN_WALLET_TOOL_NAME@@EXEEXT@
+ File @abs_top_builddir@/release/@BITCOIN_DAEMON_NAME@@EXEEXT@
+ File @abs_top_builddir@/release/@BITCOIN_CLI_NAME@@EXEEXT@
+ File @abs_top_builddir@/release/@BITCOIN_TX_NAME@@EXEEXT@
+ File @abs_top_builddir@/release/@BITCOIN_WALLET_TOOL_NAME@@EXEEXT@
SetOutPath $INSTDIR\doc
File /r /x Makefile* @abs_top_srcdir@/doc\*.*
SetOutPath $INSTDIR
diff --git a/src/init.cpp b/src/init.cpp
index 330aab5184..6aef1f8149 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1150,7 +1150,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
// Warn about relative -datadir path.
- if (args.IsArgSet("-datadir") && !fs::PathFromString(args.GetArg("-datadir", "")).is_absolute()) {
+ if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) {
LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */
"current working directory '%s'. This is fragile, because if bitcoin is started in the future "
"from a different location, it will be unable to locate the current data files. There could "
diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp
index aa936d6b7c..bd4df75d23 100644
--- a/src/qt/qvalidatedlineedit.cpp
+++ b/src/qt/qvalidatedlineedit.cpp
@@ -15,6 +15,12 @@ QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) :
connect(this, &QValidatedLineEdit::textChanged, this, &QValidatedLineEdit::markValid);
}
+void QValidatedLineEdit::setText(const QString& text)
+{
+ QLineEdit::setText(text);
+ checkValidity();
+}
+
void QValidatedLineEdit::setValid(bool _valid)
{
if(_valid == this->valid)
@@ -28,7 +34,7 @@ void QValidatedLineEdit::setValid(bool _valid)
}
else
{
- setStyleSheet(STYLE_INVALID);
+ setStyleSheet("QValidatedLineEdit { " STYLE_INVALID "}");
}
this->valid = _valid;
}
@@ -106,6 +112,7 @@ void QValidatedLineEdit::checkValidity()
void QValidatedLineEdit::setCheckValidator(const QValidator *v)
{
checkValidator = v;
+ checkValidity();
}
bool QValidatedLineEdit::isValid()
diff --git a/src/qt/qvalidatedlineedit.h b/src/qt/qvalidatedlineedit.h
index b32305f5e1..12d35aa264 100644
--- a/src/qt/qvalidatedlineedit.h
+++ b/src/qt/qvalidatedlineedit.h
@@ -29,6 +29,7 @@ private:
const QValidator *checkValidator;
public Q_SLOTS:
+ void setText(const QString&);
void setValid(bool valid);
void setEnabled(bool enabled);
diff --git a/src/random.cpp b/src/random.cpp
index 5dae80fe31..b862510524 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -32,10 +32,8 @@
#include <sys/syscall.h>
#include <linux/random.h>
#endif
-#if defined(HAVE_GETENTROPY) || (defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX))
-#include <unistd.h>
-#endif
#if defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
+#include <unistd.h>
#include <sys/random.h>
#endif
#ifdef HAVE_SYSCTL_ARND
@@ -305,16 +303,14 @@ void GetOSRand(unsigned char *ent32)
RandFailure();
}
}
-#elif defined(HAVE_GETENTROPY) && defined(__OpenBSD__)
- /* On OpenBSD this can return up to 256 bytes of entropy, will return an
- * error if more are requested.
- * The call cannot return less than the requested number of bytes.
- getentropy is explicitly limited to openbsd here, as a similar (but not
- the same) function may exist on other platforms via glibc.
+#elif defined(__OpenBSD__)
+ /* OpenBSD. From the arc4random(3) man page:
+ "Use of these functions is encouraged for almost all random number
+ consumption because the other interfaces are deficient in either
+ quality, portability, standardization, or availability."
+ The function call is always successful.
*/
- if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
- RandFailure();
- }
+ arc4random_buf(ent32, NUM_OS_RANDOM_BYTES);
// Silence a compiler warning about unused function.
(void)GetDevURandom;
#elif defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
diff --git a/src/script/script.h b/src/script/script.h
index 3425bf8102..8b7a7bb7b3 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -51,10 +51,10 @@ static const uint32_t LOCKTIME_MAX = 0xFFFFFFFFU;
static constexpr unsigned int ANNEX_TAG = 0x50;
// Validation weight per passing signature (Tapscript only, see BIP 342).
-static constexpr uint64_t VALIDATION_WEIGHT_PER_SIGOP_PASSED = 50;
+static constexpr int64_t VALIDATION_WEIGHT_PER_SIGOP_PASSED{50};
// How much weight budget is added to the witness size (Tapscript only, see BIP 342).
-static constexpr uint64_t VALIDATION_WEIGHT_OFFSET = 50;
+static constexpr int64_t VALIDATION_WEIGHT_OFFSET{50};
template <typename T>
std::vector<unsigned char> ToByteVector(const T& in)
diff --git a/src/streams.h b/src/streams.h
index 2f26be6dd8..cf8b4eb96f 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -240,76 +240,9 @@ public:
const_reference operator[](size_type pos) const { return vch[pos + nReadPos]; }
reference operator[](size_type pos) { return vch[pos + nReadPos]; }
void clear() { vch.clear(); nReadPos = 0; }
- iterator insert(iterator it, const value_type x) { return vch.insert(it, x); }
- void insert(iterator it, size_type n, const value_type x) { vch.insert(it, n, x); }
value_type* data() { return vch.data() + nReadPos; }
const value_type* data() const { return vch.data() + nReadPos; }
- void insert(iterator it, std::vector<value_type>::const_iterator first, std::vector<value_type>::const_iterator last)
- {
- if (last == first) return;
- assert(last - first > 0);
- if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
- {
- // special case for inserting at the front when there's room
- nReadPos -= (last - first);
- memcpy(&vch[nReadPos], &first[0], last - first);
- }
- else
- vch.insert(it, first, last);
- }
-
- void insert(iterator it, const value_type* first, const value_type* last)
- {
- if (last == first) return;
- assert(last - first > 0);
- if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
- {
- // special case for inserting at the front when there's room
- nReadPos -= (last - first);
- memcpy(&vch[nReadPos], &first[0], last - first);
- }
- else
- vch.insert(it, first, last);
- }
-
- iterator erase(iterator it)
- {
- if (it == vch.begin() + nReadPos)
- {
- // special case for erasing from the front
- if (++nReadPos >= vch.size())
- {
- // whenever we reach the end, we take the opportunity to clear the buffer
- nReadPos = 0;
- return vch.erase(vch.begin(), vch.end());
- }
- return vch.begin() + nReadPos;
- }
- else
- return vch.erase(it);
- }
-
- iterator erase(iterator first, iterator last)
- {
- if (first == vch.begin() + nReadPos)
- {
- // special case for erasing from the front
- if (last == vch.end())
- {
- nReadPos = 0;
- return vch.erase(vch.begin(), vch.end());
- }
- else
- {
- nReadPos = (last - vch.begin());
- return last;
- }
- }
- else
- return vch.erase(first, last);
- }
-
inline void Compact()
{
vch.erase(vch.begin(), vch.begin() + nReadPos);
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
index 922fd8e513..82e4e1c90f 100644
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -324,7 +324,7 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
tx.vout.resize(1);
tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate
tx.vout[0].scriptPubKey.assign(InsecureRand32() & 0x3F, 0); // Random sizes so we can test memory usage accounting
- unsigned int height = InsecureRand32();
+ const int height{int(InsecureRand32() >> 1)};
Coin old_coin;
// 2/20 times create a new coinbase
@@ -393,11 +393,11 @@ BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
// Update the expected result to know about the new output coins
assert(tx.vout.size() == 1);
const COutPoint outpoint(tx.GetHash(), 0);
- result[outpoint] = Coin{tx.vout[0], int(height), CTransaction(tx).IsCoinBase()};
+ result[outpoint] = Coin{tx.vout[0], height, CTransaction{tx}.IsCoinBase()};
// Call UpdateCoins on the top cache
CTxUndo undo;
- UpdateCoins(CTransaction(tx), *(stack.back()), undo, int(height));
+ UpdateCoins(CTransaction{tx}, *(stack.back()), undo, height);
// Update the utxo set for future spends
utxoset.insert(outpoint);
diff --git a/src/test/fuzz/coins_view.cpp b/src/test/fuzz/coins_view.cpp
index 994b4b9e49..360dc00307 100644
--- a/src/test/fuzz/coins_view.cpp
+++ b/src/test/fuzz/coins_view.cpp
@@ -211,7 +211,7 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view)
return;
}
bool expected_code_path = false;
- const int height = fuzzed_data_provider.ConsumeIntegral<int>();
+ const int height{int(fuzzed_data_provider.ConsumeIntegral<uint32_t>() >> 1)};
const bool possible_overwrite = fuzzed_data_provider.ConsumeBool();
try {
AddCoins(coins_view_cache, transaction, height, possible_overwrite);
diff --git a/src/test/fuzz/string.cpp b/src/test/fuzz/string.cpp
index 8f071b71fe..ca57af25c4 100644
--- a/src/test/fuzz/string.cpp
+++ b/src/test/fuzz/string.cpp
@@ -145,7 +145,8 @@ FUZZ_TARGET(string)
(void)CopyrightHolders(random_string_1);
FeeEstimateMode fee_estimate_mode;
(void)FeeModeFromString(random_string_1, fee_estimate_mode);
- (void)FormatParagraph(random_string_1, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 1000), fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 1000));
+ const auto width{fuzzed_data_provider.ConsumeIntegralInRange<size_t>(1, 1000)};
+ (void)FormatParagraph(random_string_1, width, fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, width));
(void)FormatSubVersion(random_string_1, fuzzed_data_provider.ConsumeIntegral<int>(), random_string_vector);
(void)GetDescriptorChecksum(random_string_1);
(void)HelpExampleCli(random_string_1, random_string_2);
diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp
index d5142c8d74..597d774673 100644
--- a/src/test/getarg_tests.cpp
+++ b/src/test/getarg_tests.cpp
@@ -159,6 +159,98 @@ BOOST_AUTO_TEST_CASE(intarg)
BOOST_CHECK_EQUAL(m_local_args.GetIntArg("-bar", 11), 0);
}
+BOOST_AUTO_TEST_CASE(patharg)
+{
+ const auto dir = std::make_pair("-dir", ArgsManager::ALLOW_ANY);
+ SetupArgs({dir});
+ ResetArgs("");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), fs::path{});
+
+ const fs::path root_path{"/"};
+ ResetArgs("-dir=/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+ ResetArgs("-dir=/.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+ ResetArgs("-dir=/./");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+ ResetArgs("-dir=/.//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), root_path);
+
+#ifdef WIN32
+ const fs::path win_root_path{"C:\\"};
+ ResetArgs("-dir=C:\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\.\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+
+ ResetArgs("-dir=C:\\.\\\\");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), win_root_path);
+#endif
+
+ const fs::path absolute_path{"/home/user/.bitcoin"};
+ ResetArgs("-dir=/home/user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/root/../home/user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/./user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/./");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ ResetArgs("-dir=/home/user/.bitcoin/.//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), absolute_path);
+
+ const fs::path relative_path{"user/.bitcoin"};
+ ResetArgs("-dir=user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=somewhere/../user/.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/./.bitcoin");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/.");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/./");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+
+ ResetArgs("-dir=user/.bitcoin/.//");
+ BOOST_CHECK_EQUAL(m_local_args.GetPathArg("-dir"), relative_path);
+}
+
BOOST_AUTO_TEST_CASE(doubledash)
{
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index 8b8133b689..2441847f99 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -215,51 +215,6 @@ BOOST_AUTO_TEST_CASE(noncanonical)
BOOST_CHECK_EXCEPTION(ReadCompactSize(ss), std::ios_base::failure, isCanonicalException);
}
-BOOST_AUTO_TEST_CASE(insert_delete)
-{
- constexpr auto B2I{[](std::byte b) { return std::to_integer<uint8_t>(b); }};
-
- // Test inserting/deleting bytes.
- CDataStream ss(SER_DISK, 0);
- BOOST_CHECK_EQUAL(ss.size(), 0U);
-
- ss.write(MakeByteSpan("\x00\x01\x02\xff").first(4));
- BOOST_CHECK_EQUAL(ss.size(), 4U);
-
- uint8_t c{11};
-
- // Inserting at beginning/end/middle:
- ss.insert(ss.begin(), std::byte{c});
- BOOST_CHECK_EQUAL(ss.size(), 5U);
- BOOST_CHECK_EQUAL(B2I(ss[0]), c);
- BOOST_CHECK_EQUAL(B2I(ss[1]), 0);
-
- ss.insert(ss.end(), std::byte{c});
- BOOST_CHECK_EQUAL(ss.size(), 6U);
- BOOST_CHECK_EQUAL(B2I(ss[4]), 0xff);
- BOOST_CHECK_EQUAL(B2I(ss[5]), c);
-
- ss.insert(ss.begin() + 2, std::byte{c});
- BOOST_CHECK_EQUAL(ss.size(), 7U);
- BOOST_CHECK_EQUAL(B2I(ss[2]), c);
-
- // Delete at beginning/end/middle
- ss.erase(ss.begin());
- BOOST_CHECK_EQUAL(ss.size(), 6U);
- BOOST_CHECK_EQUAL(B2I(ss[0]), 0);
-
- ss.erase(ss.begin()+ss.size()-1);
- BOOST_CHECK_EQUAL(ss.size(), 5U);
- BOOST_CHECK_EQUAL(B2I(ss[4]), 0xff);
-
- ss.erase(ss.begin()+1);
- BOOST_CHECK_EQUAL(ss.size(), 4U);
- BOOST_CHECK_EQUAL(B2I(ss[0]), 0);
- BOOST_CHECK_EQUAL(B2I(ss[1]), 1);
- BOOST_CHECK_EQUAL(B2I(ss[2]), 2);
- BOOST_CHECK_EQUAL(B2I(ss[3]), 0xff);
-}
-
BOOST_AUTO_TEST_CASE(class_methods)
{
int intval(100);
diff --git a/src/test/streams_tests.cpp b/src/test/streams_tests.cpp
index 6a69fe9840..0925e2e9ee 100644
--- a/src/test/streams_tests.cpp
+++ b/src/test/streams_tests.cpp
@@ -8,6 +8,8 @@
#include <boost/test/unit_test.hpp>
+using namespace std::string_literals;
+
BOOST_FIXTURE_TEST_SUITE(streams_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(streams_vector_writer)
@@ -162,46 +164,35 @@ BOOST_AUTO_TEST_CASE(bitstream_reader_writer)
BOOST_AUTO_TEST_CASE(streams_serializedata_xor)
{
std::vector<std::byte> in;
- std::vector<char> expected_xor;
- CDataStream ds(in, 0, 0);
// Degenerate case
- ds.Xor({0x00, 0x00});
- BOOST_CHECK_EQUAL(
- std::string(expected_xor.begin(), expected_xor.end()),
- ds.str());
+ {
+ CDataStream ds{in, 0, 0};
+ ds.Xor({0x00, 0x00});
+ BOOST_CHECK_EQUAL(""s, ds.str());
+ }
in.push_back(std::byte{0x0f});
in.push_back(std::byte{0xf0});
- expected_xor.push_back('\xf0');
- expected_xor.push_back('\x0f');
// Single character key
-
- ds.clear();
- ds.insert(ds.begin(), in.begin(), in.end());
-
- ds.Xor({0xff});
- BOOST_CHECK_EQUAL(
- std::string(expected_xor.begin(), expected_xor.end()),
- ds.str());
+ {
+ CDataStream ds{in, 0, 0};
+ ds.Xor({0xff});
+ BOOST_CHECK_EQUAL("\xf0\x0f"s, ds.str());
+ }
// Multi character key
in.clear();
- expected_xor.clear();
in.push_back(std::byte{0xf0});
in.push_back(std::byte{0x0f});
- expected_xor.push_back('\x0f');
- expected_xor.push_back('\x00');
-
- ds.clear();
- ds.insert(ds.begin(), in.begin(), in.end());
- ds.Xor({0xff, 0x0f});
- BOOST_CHECK_EQUAL(
- std::string(expected_xor.begin(), expected_xor.end()),
- ds.str());
+ {
+ CDataStream ds{in, 0, 0};
+ ds.Xor({0xff, 0x0f});
+ BOOST_CHECK_EQUAL("\x0f\x00"s, ds.str());
+ }
}
BOOST_AUTO_TEST_CASE(streams_buffered_file)
diff --git a/src/util/strencodings.cpp b/src/util/strencodings.cpp
index a386f2b7b3..940fa90da2 100644
--- a/src/util/strencodings.cpp
+++ b/src/util/strencodings.cpp
@@ -113,7 +113,7 @@ void SplitHostPort(std::string in, uint16_t& portOut, std::string& hostOut)
// if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator
bool fHaveColon = colon != in.npos;
bool fBracketed = fHaveColon && (in[0] == '[' && in[colon - 1] == ']'); // if there is a colon, and in[0]=='[', colon is not 0, so in[colon-1] is safe
- bool fMultiColon = fHaveColon && (in.find_last_of(':', colon - 1) != in.npos);
+ bool fMultiColon{fHaveColon && colon != 0 && (in.find_last_of(':', colon - 1) != in.npos)};
if (fHaveColon && (colon == 0 || fBracketed || !fMultiColon)) {
uint16_t n;
if (ParseUInt16(in.substr(colon + 1), &n)) {
@@ -328,6 +328,7 @@ bool ParseUInt64(const std::string& str, uint64_t* out)
std::string FormatParagraph(const std::string& in, size_t width, size_t indent)
{
+ assert(width >= indent);
std::stringstream out;
size_t ptr = 0;
size_t indented = 0;
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 8d0cec249d..5cef2be07a 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -74,6 +74,7 @@
#include <memory>
#include <optional>
#include <string>
+#include <system_error>
#include <thread>
#include <typeinfo>
@@ -245,19 +246,6 @@ static std::optional<util::SettingsValue> InterpretValue(const KeyInfo& key, con
return value;
}
-namespace {
-fs::path StripRedundantLastElementsOfPath(const fs::path& path)
-{
- auto result = path;
- while (result.filename().empty() || fs::PathToString(result.filename()) == ".") {
- result = result.parent_path();
- }
-
- assert(fs::equivalent(result, path.lexically_normal()));
- return result;
-}
-} // namespace
-
// Define default constructor and destructor that are not inline, so code instantiating this class doesn't need to
// #include class definitions for all members.
// For example, m_settings has an internal dependency on univalue.
@@ -399,6 +387,13 @@ std::optional<unsigned int> ArgsManager::GetArgFlags(const std::string& name) co
return std::nullopt;
}
+fs::path ArgsManager::GetPathArg(std::string pathlike_arg) const
+{
+ auto result = fs::PathFromString(GetArg(pathlike_arg, "")).lexically_normal();
+ // Remove trailing slash, if present.
+ return result.has_filename() ? result : result.parent_path();
+}
+
const fs::path& ArgsManager::GetBlocksDirPath() const
{
LOCK(cs_args);
@@ -409,7 +404,7 @@ const fs::path& ArgsManager::GetBlocksDirPath() const
if (!path.empty()) return path;
if (IsArgSet("-blocksdir")) {
- path = fs::absolute(fs::PathFromString(GetArg("-blocksdir", "")));
+ path = fs::absolute(GetPathArg("-blocksdir"));
if (!fs::is_directory(path)) {
path = "";
return path;
@@ -433,9 +428,9 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
// this function
if (!path.empty()) return path;
- std::string datadir = GetArg("-datadir", "");
+ const fs::path datadir{GetPathArg("-datadir")};
if (!datadir.empty()) {
- path = fs::absolute(StripRedundantLastElementsOfPath(fs::PathFromString(datadir)));
+ path = fs::absolute(datadir);
if (!fs::is_directory(path)) {
path = "";
return path;
@@ -443,15 +438,18 @@ const fs::path& ArgsManager::GetDataDir(bool net_specific) const
} else {
path = GetDefaultDataDir();
}
- if (net_specific)
- path /= fs::PathFromString(BaseParams().DataDir());
- if (fs::create_directories(path)) {
- // This is the first run, create wallets subdirectory too
+ if (!fs::exists(path)) {
fs::create_directories(path / "wallets");
}
- path = StripRedundantLastElementsOfPath(path);
+ if (net_specific && !BaseParams().DataDir().empty()) {
+ path /= fs::PathFromString(BaseParams().DataDir());
+ if (!fs::exists(path)) {
+ fs::create_directories(path / "wallets");
+ }
+ }
+
return path;
}
@@ -812,8 +810,8 @@ fs::path GetDefaultDataDir()
bool CheckDataDirOption()
{
- std::string datadir = gArgs.GetArg("-datadir", "");
- return datadir.empty() || fs::is_directory(fs::absolute(fs::PathFromString(datadir)));
+ const fs::path datadir{gArgs.GetPathArg("-datadir")};
+ return datadir.empty() || fs::is_directory(fs::absolute(datadir));
}
fs::path GetConfigFile(const std::string& confPath)
@@ -1064,13 +1062,9 @@ void ArgsManager::LogArgs() const
bool RenameOver(fs::path src, fs::path dest)
{
-#ifdef WIN32
- return MoveFileExW(src.wstring().c_str(), dest.wstring().c_str(),
- MOVEFILE_REPLACE_EXISTING) != 0;
-#else
- int rc = std::rename(src.c_str(), dest.c_str());
- return (rc == 0);
-#endif /* WIN32 */
+ std::error_code error;
+ fs::rename(src, dest, error);
+ return !error;
}
/**
diff --git a/src/util/system.h b/src/util/system.h
index a8fd21fcaa..a72ba3f3ed 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -69,7 +69,13 @@ void DirectoryCommit(const fs::path &dirname);
bool TruncateFile(FILE *file, unsigned int length);
int RaiseFileDescriptorLimit(int nMinFD);
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
+
+/**
+ * Rename src to dest.
+ * @return true if the rename was successful.
+ */
[[nodiscard]] bool RenameOver(fs::path src, fs::path dest);
+
bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only=false);
void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name);
bool DirIsWritable(const fs::path& directory);
@@ -265,6 +271,16 @@ protected:
std::optional<const Command> GetCommand() const;
/**
+ * Get a normalized path from a specified pathlike argument
+ *
+ * It is guaranteed that the returned path has no trailing slashes.
+ *
+ * @param pathlike_arg Pathlike argument to get a path from (e.g., "-datadir", "-blocksdir" or "-walletdir")
+ * @return Normalized path which is get from a specified pathlike argument
+ */
+ fs::path GetPathArg(std::string pathlike_arg) const;
+
+ /**
* Get blocks directory path
*
* @return Blocks path which is network specific
diff --git a/src/validation.cpp b/src/validation.cpp
index c12dc9e8b6..e20e2fe523 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1787,8 +1787,9 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
error("DisconnectBlock(): transaction and undo data inconsistent");
return DISCONNECT_FAILED;
}
- for (unsigned int j = tx.vin.size(); j-- > 0;) {
- const COutPoint &out = tx.vin[j].prevout;
+ for (unsigned int j = tx.vin.size(); j > 0;) {
+ --j;
+ const COutPoint& out = tx.vin[j].prevout;
int res = ApplyTxInUndo(std::move(txundo.vprevout[j]), view, out);
if (res == DISCONNECT_FAILED) return DISCONNECT_FAILED;
fClean = fClean && res != DISCONNECT_UNCLEAN;
@@ -4493,7 +4494,8 @@ bool LoadMempool(CTxMemPool& pool, CChainState& active_chainstate, FopenFn mocka
}
uint64_t num;
file >> num;
- while (num--) {
+ while (num) {
+ --num;
CTransactionRef tx;
int64_t nTime;
int64_t nFeeDelta;
diff --git a/src/validation.h b/src/validation.h
index fb258005f1..fdfd29d1f8 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -597,7 +597,8 @@ public:
EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
/** Import blocks from an external file */
- void LoadExternalBlockFile(FILE* fileIn, FlatFilePos* dbp = nullptr);
+ void LoadExternalBlockFile(FILE* fileIn, FlatFilePos* dbp = nullptr)
+ EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex);
/**
* Update the on-disk chain state.
@@ -639,7 +640,9 @@ public:
*/
bool ActivateBestChain(
BlockValidationState& state,
- std::shared_ptr<const CBlock> pblock = nullptr) LOCKS_EXCLUDED(m_chainstate_mutex, cs_main);
+ std::shared_ptr<const CBlock> pblock = nullptr)
+ EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex)
+ LOCKS_EXCLUDED(::cs_main);
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, BlockValidationState& state, CBlockIndex** ppindex, bool fRequested, const FlatFilePos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
@@ -657,9 +660,15 @@ public:
*
* May not be called in a validationinterface callback.
*/
- bool PreciousBlock(BlockValidationState& state, CBlockIndex* pindex) LOCKS_EXCLUDED(cs_main);
+ bool PreciousBlock(BlockValidationState& state, CBlockIndex* pindex)
+ EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex)
+ LOCKS_EXCLUDED(::cs_main);
+
/** Mark a block as invalid. */
- bool InvalidateBlock(BlockValidationState& state, CBlockIndex* pindex) LOCKS_EXCLUDED(m_chainstate_mutex, cs_main);
+ bool InvalidateBlock(BlockValidationState& state, CBlockIndex* pindex)
+ EXCLUSIVE_LOCKS_REQUIRED(!m_chainstate_mutex)
+ LOCKS_EXCLUDED(::cs_main);
+
/** Remove invalidity status from a block and its descendants. */
void ResetBlockFailureFlags(CBlockIndex* pindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp
index 6a74f2eb84..633d8c5450 100644
--- a/src/wallet/load.cpp
+++ b/src/wallet/load.cpp
@@ -28,7 +28,7 @@ bool VerifyWallets(WalletContext& context)
ArgsManager& args = *Assert(context.args);
if (args.IsArgSet("-walletdir")) {
- fs::path wallet_dir = fs::PathFromString(args.GetArg("-walletdir", ""));
+ const fs::path wallet_dir{args.GetPathArg("-walletdir")};
std::error_code error;
// The canonical path cleans the path, preventing >1 Berkeley environment instances for the same directory
// It also lets the fs::exists and fs::is_directory checks below pass on windows, since they return false
diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp
index 33ec715b51..883a3c102b 100644
--- a/src/wallet/rpc/wallet.cpp
+++ b/src/wallet/rpc/wallet.cpp
@@ -57,6 +57,7 @@ static RPCHelpMan getwalletinfo()
{RPCResult::Type::NUM, "progress", "scanning progress percentage [0.0, 1.0]"},
}},
{RPCResult::Type::BOOL, "descriptors", "whether this wallet uses descriptors for scriptPubKey management"},
+ {RPCResult::Type::BOOL, "external_signer", "whether this wallet is configured to use an external signer such as a hardware wallet"},
}},
},
RPCExamples{
@@ -117,6 +118,7 @@ static RPCHelpMan getwalletinfo()
obj.pushKV("scanning", false);
}
obj.pushKV("descriptors", pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
+ obj.pushKV("external_signer", pwallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER));
return obj;
},
};
diff --git a/src/wallet/test/init_tests.cpp b/src/wallet/test/init_tests.cpp
index c1cae5c5f6..7fdecc5642 100644
--- a/src/wallet/test/init_tests.cpp
+++ b/src/wallet/test/init_tests.cpp
@@ -18,7 +18,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)
SetWalletDir(m_walletdir_path_cases["default"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)
SetWalletDir(m_walletdir_path_cases["custom"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)
SetWalletDir(m_walletdir_path_cases["trailing"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)
SetWalletDir(m_walletdir_path_cases["trailing2"]);
bool result = m_wallet_loader->verify();
BOOST_CHECK(result == true);
- fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ fs::path walletdir = gArgs.GetPathArg("-walletdir");
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
BOOST_CHECK_EQUAL(walletdir, expected_path);
}
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
index ce276451c3..df1b10a634 100644
--- a/src/wallet/walletutil.cpp
+++ b/src/wallet/walletutil.cpp
@@ -13,7 +13,7 @@ fs::path GetWalletDir()
fs::path path;
if (gArgs.IsArgSet("-walletdir")) {
- path = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
+ path = gArgs.GetPathArg("-walletdir");
if (!fs::is_directory(path)) {
// If the path specified doesn't exist, we return the deliberately
// invalid empty string.
diff --git a/test/functional/feature_syscall_sandbox.py b/test/functional/feature_syscall_sandbox.py
index caf7f1e7fc..e430542845 100755
--- a/test/functional/feature_syscall_sandbox.py
+++ b/test/functional/feature_syscall_sandbox.py
@@ -14,7 +14,7 @@ class SyscallSandboxTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
if not self.is_syscall_sandbox_compiled():
raise SkipTest("bitcoind has not been built with syscall sandbox enabled.")
- if self.options.nosandbox:
+ if self.disable_syscall_sandbox:
raise SkipTest("--nosandbox passed to test runner.")
def run_test(self):
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index dabde13bf1..210025104e 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -36,6 +36,7 @@ def assert_approx(v, vexp, vspan=0.00001):
def assert_fee_amount(fee, tx_size, feerate_BTC_kvB):
"""Assert the fee is in range."""
+ assert isinstance(tx_size, int)
target_fee = get_fee(tx_size, feerate_BTC_kvB)
if fee < target_fee:
raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)" % (str(fee), str(target_fee)))
@@ -219,7 +220,13 @@ def str_to_b64str(string):
def ceildiv(a, b):
- """Divide 2 ints and round up to next int rather than round down"""
+ """
+ Divide 2 ints and round up to next int rather than round down
+ Implementation requires python integers, which have a // operator that does floor division.
+ Other types like decimal.Decimal whose // operator truncates towards 0 will not work.
+ """
+ assert isinstance(a, int)
+ assert isinstance(b, int)
return -(-a // b)
@@ -227,7 +234,7 @@ def get_fee(tx_size, feerate_btc_kvb):
"""Calculate the fee in BTC given a feerate is BTC/kvB. Reflects CFeeRate::GetFee"""
feerate_sat_kvb = int(feerate_btc_kvb * Decimal(1e8)) # Fee in sat/kvb as an int to avoid float precision errors
target_fee_sat = ceildiv(feerate_sat_kvb * tx_size, 1000) # Round calculated fee up to nearest sat
- return satoshi_round(target_fee_sat / Decimal(1e8)) # Truncate BTC result to nearest sat
+ return target_fee_sat / Decimal(1e8) # Return result in BTC
def satoshi_round(amount):
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index e833128063..1a0d62aa8f 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -532,8 +532,11 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
max_len_name = len(max(test_list, key=len))
test_count = len(test_list)
+ all_passed = True
i = 0
while i < test_count:
+ if failfast and not all_passed:
+ break
for test_result, testdir, stdout, stderr in job_queue.get_next():
test_results.append(test_result)
i += 1
@@ -543,6 +546,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
elif test_result.status == "Skipped":
logging.debug("%s skipped" % (done_str))
else:
+ all_passed = False
print("%s failed, Duration: %s s\n" % (done_str, test_result.time))
print(BOLD[1] + 'stdout:\n' + BOLD[0] + stdout + '\n')
print(BOLD[1] + 'stderr:\n' + BOLD[0] + stderr + '\n')
@@ -576,7 +580,7 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
if not os.listdir(tmpdir):
os.rmdir(tmpdir)
- all_passed = all(map(lambda test_result: test_result.was_successful, test_results)) and coverage_passed
+ all_passed = all_passed and coverage_passed
# Clean up dangling processes if any. This may only happen with --failfast option.
# Killing the process group will also terminate the current process but that is
diff --git a/test/functional/wallet_send.py b/test/functional/wallet_send.py
index 843a9f52b7..86e36be8f7 100755
--- a/test/functional/wallet_send.py
+++ b/test/functional/wallet_send.py
@@ -16,6 +16,7 @@ from test_framework.util import (
assert_fee_amount,
assert_greater_than,
assert_raises_rpc_error,
+ count_bytes,
)
from test_framework.wallet_util import bytes_to_wif
@@ -320,20 +321,20 @@ class WalletSendTest(BitcoinTestFramework):
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=7, add_to_wallet=False)
fee = self.nodes[1].decodepsbt(res["psbt"])["fee"]
- assert_fee_amount(fee, Decimal(len(res["hex"]) / 2), Decimal("0.00007"))
+ assert_fee_amount(fee, count_bytes(res["hex"]), Decimal("0.00007"))
# "unset" and None are treated the same for estimate_mode
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, fee_rate=2, estimate_mode="unset", add_to_wallet=False)
fee = self.nodes[1].decodepsbt(res["psbt"])["fee"]
- assert_fee_amount(fee, Decimal(len(res["hex"]) / 2), Decimal("0.00002"))
+ assert_fee_amount(fee, count_bytes(res["hex"]), Decimal("0.00002"))
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=4.531, add_to_wallet=False)
fee = self.nodes[1].decodepsbt(res["psbt"])["fee"]
- assert_fee_amount(fee, Decimal(len(res["hex"]) / 2), Decimal("0.00004531"))
+ assert_fee_amount(fee, count_bytes(res["hex"]), Decimal("0.00004531"))
res = self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=3, add_to_wallet=False)
fee = self.nodes[1].decodepsbt(res["psbt"])["fee"]
- assert_fee_amount(fee, Decimal(len(res["hex"]) / 2), Decimal("0.00003"))
+ assert_fee_amount(fee, count_bytes(res["hex"]), Decimal("0.00003"))
# Test that passing fee_rate as both an argument and an option raises.
self.test_send(from_wallet=w0, to_wallet=w1, amount=1, arg_fee_rate=1, fee_rate=1, add_to_wallet=False,
diff --git a/test/functional/wallet_signer.py b/test/functional/wallet_signer.py
index 9e2db517b6..423cfecdc0 100755
--- a/test/functional/wallet_signer.py
+++ b/test/functional/wallet_signer.py
@@ -72,10 +72,12 @@ class WalletSignerTest(BitcoinTestFramework):
self.nodes[1].createwallet(wallet_name='hww', disable_private_keys=True, descriptors=True, external_signer=True)
hww = self.nodes[1].get_wallet_rpc('hww')
+ assert_equal(hww.getwalletinfo()["external_signer"], True)
# Flag can't be set afterwards (could be added later for non-blank descriptor based watch-only wallets)
self.nodes[1].createwallet(wallet_name='not_hww', disable_private_keys=True, descriptors=True, external_signer=False)
not_hww = self.nodes[1].get_wallet_rpc('not_hww')
+ assert_equal(not_hww.getwalletinfo()["external_signer"], False)
assert_raises_rpc_error(-8, "Wallet flag is immutable: external_signer", not_hww.setwalletflag, "external_signer", True)
# assert_raises_rpc_error(-4, "Multiple signers found, please specify which to use", wallet_name='not_hww', disable_private_keys=True, descriptors=True, external_signer=True)
diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan
index ec13acb689..2084e02b8a 100644
--- a/test/sanitizer_suppressions/ubsan
+++ b/test/sanitizer_suppressions/ubsan
@@ -43,7 +43,6 @@ shift-base:test/fuzz/crypto_diff_fuzz_chacha20.cpp
# contains files in which we expect unsigned integer overflows to occur. The
# list is used to suppress -fsanitize=integer warnings when running our CI UBSan
# job.
-unsigned-integer-overflow:addrman.cpp
unsigned-integer-overflow:arith_uint256.h
unsigned-integer-overflow:common/bloom.cpp
unsigned-integer-overflow:coins.cpp
@@ -57,10 +56,7 @@ unsigned-integer-overflow:pubkey.h
unsigned-integer-overflow:script/interpreter.cpp
unsigned-integer-overflow:txmempool.cpp
unsigned-integer-overflow:util/strencodings.cpp
-unsigned-integer-overflow:validation.cpp
-implicit-integer-sign-change:addrman.h
implicit-integer-sign-change:bech32.cpp
-implicit-integer-sign-change:coins.h
implicit-integer-sign-change:compat/stdin.cpp
implicit-integer-sign-change:compressor.h
implicit-integer-sign-change:crypto/
@@ -72,7 +68,6 @@ implicit-integer-sign-change:script/interpreter.cpp
implicit-integer-sign-change:serialize.h
implicit-integer-sign-change:txmempool.cpp
implicit-signed-integer-truncation:addrman.cpp
-implicit-signed-integer-truncation:addrman.h
implicit-signed-integer-truncation:crypto/
implicit-unsigned-integer-truncation:crypto/
shift-base:arith_uint256.cpp