aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml40
-rw-r--r--build_msvc/README.md16
-rwxr-xr-xbuild_msvc/msvc-autogen.py4
-rwxr-xr-xci/test/00_setup_env_mac_native_x86_64.sh (renamed from ci/test/00_setup_env_mac_host.sh)0
-rw-r--r--configure.ac7
-rwxr-xr-xcontrib/guix/libexec/build.sh4
-rw-r--r--contrib/guix/manifest.scm17
-rw-r--r--contrib/guix/patches/lief-fix-ppc64-nx-default.patch29
-rw-r--r--doc/build-unix.md15
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.leveldb.include1
-rw-r--r--src/Makefile.test.include4
-rw-r--r--src/coins.h1
-rw-r--r--src/dbwrapper.cpp2
-rw-r--r--src/dbwrapper.h21
-rw-r--r--src/i2p.cpp2
-rw-r--r--src/net_processing.cpp1
-rw-r--r--src/qt/bitcoin.cpp23
-rw-r--r--src/rpc/mempool.cpp6
-rw-r--r--src/rpc/server.cpp12
-rw-r--r--src/test/fuzz/util.cpp9
-rw-r--r--src/test/fuzz/util.h2
-rw-r--r--src/test/sock_tests.cpp18
-rw-r--r--src/test/util/net.h7
-rw-r--r--src/txdb.cpp6
-rw-r--r--src/util/sock.cpp45
-rw-r--r--src/util/sock.h21
-rw-r--r--src/util/time.h7
-rwxr-xr-xtest/functional/feature_rbf.py1
-rwxr-xr-xtest/functional/feature_signet.py8
-rwxr-xr-xtest/functional/p2p_permissions.py1
-rwxr-xr-xtest/functional/test_framework/test_framework.py12
-rwxr-xr-xtest/functional/wallet_importdescriptors.py2
33 files changed, 172 insertions, 174 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index ccf7077546..ed10ef5455 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -35,22 +35,30 @@ base_template: &BASE_TEMPLATE
main_template: &MAIN_TEMPLATE
timeout_in: 120m # https://cirrus-ci.org/faq/#instance-timed-out
+ ccache_cache:
+ folder: "/tmp/ccache_dir"
+ ci_script:
+ - ./ci/test_run_all.sh
+
+global_task_template: &GLOBAL_TASK_TEMPLATE
+ << : *BASE_TEMPLATE
container:
# https://cirrus-ci.org/faq/#are-there-any-limits
# Each project has 16 CPU in total, assign 2 to each container, so that 8 tasks run in parallel
cpu: 2
greedy: true
memory: 8G # Set to 8GB to avoid OOM. https://cirrus-ci.org/guide/linux/#linux-containers
- ccache_cache:
- folder: "/tmp/ccache_dir"
depends_built_cache:
folder: "depends/built"
fingerprint_script: echo $CIRRUS_TASK_NAME $(git rev-list -1 HEAD ./depends)
- ci_script:
- - ./ci/test_run_all.sh
+ << : *MAIN_TEMPLATE
-global_task_template: &GLOBAL_TASK_TEMPLATE
+macos_native_task_template: &MACOS_NATIVE_TASK_TEMPLATE
<< : *BASE_TEMPLATE
+ check_clang_script:
+ - clang --version
+ brew_install_script:
+ - brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
<< : *MAIN_TEMPLATE
compute_credits_template: &CREDITS_TEMPLATE
@@ -86,17 +94,17 @@ task:
FILE_ENV: "./ci/test/00_setup_env_native_tidy.sh"
task:
- name: "Win64 native [msvc]"
+ name: "Win64 native [vs2022]"
<< : *FILTER_TEMPLATE
windows_container:
- cpu: 4
+ cpu: 6
memory: 8G
- image: cirrusci/windowsservercore:visualstudio2019
+ image: cirrusci/windowsservercore:visualstudio2022
timeout_in: 120m
env:
- PATH: 'C:\jom;C:\Python39;C:\Python39\Scripts;C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin;%PATH%'
+ PATH: 'C:\jom;C:\Python39;C:\Python39\Scripts;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin;%PATH%'
PYTHONUTF8: 1
- CI_VCPKG_TAG: '2022.04.12'
+ CI_VCPKG_TAG: '2022.06.16.1'
VCPKG_DOWNLOADS: 'C:\Users\ContainerAdministrator\AppData\Local\vcpkg\downloads'
VCPKG_DEFAULT_BINARY_CACHE: 'C:\Users\ContainerAdministrator\AppData\Local\vcpkg\archives'
CCACHE_DIR: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
@@ -105,7 +113,7 @@ task:
QT_LOCAL_PATH: 'C:\qt-everywhere-opensource-src-5.15.3.zip'
QT_SOURCE_DIR: 'C:\qt-everywhere-src-5.15.3'
QTBASEDIR: 'C:\Qt_static'
- x64_NATIVE_TOOLS: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"'
+ x64_NATIVE_TOOLS: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"'
QT_CONFIGURE_COMMAND: '..\configure -release -silent -opensource -confirm-license -opengl desktop -static -static-runtime -mp -qt-zlib -qt-pcre -qt-libpng -nomake examples -nomake tests -nomake tools -no-angle -no-dbus -no-gif -no-gtk -no-ico -no-icu -no-libjpeg -no-libudev -no-sql-sqlite -no-sql-odbc -no-sqlite -no-vulkan -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip doc -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtmultimedia -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qtsvg -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebglplugin -skip qtwebsockets -skip qtwebview -skip qtx11extras -skip qtxmlpatterns -no-openssl -no-feature-bearermanagement -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sql -no-feature-sqlmodel -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-xml'
IgnoreWarnIntDirInTempDetected: 'true'
merge_script:
@@ -171,7 +179,7 @@ task:
build_script:
- '%x64_NATIVE_TOOLS%'
- cd %CIRRUS_WORKING_DIR%
- - ccache --zero-stats
+ - ccache --zero-stats --max-size=%CCACHE_SIZE%
- python build_msvc\msvc-autogen.py
- msbuild build_msvc\bitcoin.sln -property:CLToolExe=%WRAPPED_CL% -property:Configuration=Release -maxCpuCount -verbosity:minimal -noLogo
- ccache --show-stats
@@ -306,18 +314,16 @@ task:
FILE_ENV: "./ci/test/00_setup_env_mac.sh"
task:
- name: 'macOS 12 native [gui, system sqlite only] [no depends]'
- brew_install_script:
- - brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
- << : *GLOBAL_TASK_TEMPLATE
+ name: 'macOS 12 native x86_64 [gui, system sqlite] [no depends]'
macos_instance:
# Use latest image, but hardcode version to avoid silent upgrades (and breaks)
image: monterey-xcode-13.3 # https://cirrus-ci.org/guide/macOS
+ << : *MACOS_NATIVE_TASK_TEMPLATE
env:
<< : *CIRRUS_EPHEMERAL_WORKER_TEMPLATE_ENV
CI_USE_APT_INSTALL: "no"
PACKAGE_MANAGER_INSTALL: "echo" # Nothing to do
- FILE_ENV: "./ci/test/00_setup_env_mac_host.sh"
+ FILE_ENV: "./ci/test/00_setup_env_mac_native_x86_64.sh"
task:
name: 'ARM64 Android APK [focal]'
diff --git a/build_msvc/README.md b/build_msvc/README.md
index 7feee6b766..d59942cb17 100644
--- a/build_msvc/README.md
+++ b/build_msvc/README.md
@@ -3,7 +3,7 @@ Building Bitcoin Core with Visual Studio
Introduction
---------------------
-Solution and project files to build Bitcoin Core with `msbuild` or Visual Studio can be found in the `build_msvc` directory. The build has been tested with Visual Studio 2019 (building with earlier versions of Visual Studio should not be expected to work).
+Solution and project files to build Bitcoin Core with `msbuild` or Visual Studio can be found in the `build_msvc` directory. The build has been tested with Visual Studio 2022 and Visual Studio 2019 (building with earlier versions of Visual Studio should not be expected to work).
To build Bitcoin Core from the command-line, it is sufficient to only install the Visual Studio Build Tools component.
@@ -30,7 +30,7 @@ To build Bitcoin Core with the GUI, a static build of Qt is required.
1. Download a single ZIP archive of Qt source code from https://download.qt.io/official_releases/qt/ (e.g., [`qt-everywhere-opensource-src-5.15.3.zip`](https://download.qt.io/official_releases/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.zip)), and expand it into a dedicated folder. The following instructions assume that this folder is `C:\dev\qt-source`.
-2. Open "x64 Native Tools Command Prompt for VS 2019", and input the following commands:
+2. Open "x64 Native Tools Command Prompt for VS 2022", and input the following commands:
```cmd
cd C:\dev\qt-source
mkdir build
@@ -47,21 +47,21 @@ To build Bitcoin Core without Qt, unload or disable the `bitcoin-qt`, `libbitcoi
Building
---------------------
-1. Use Python to generate `*.vcxproj` from Makefile:
+1. Use Python to generate `*.vcxproj` for the Visual Studio 2022 toolchain from Makefile:
-```
-PS >py -3 msvc-autogen.py
+```cmd
+python build_msvc\msvc-autogen.py
```
2. An optional step is to adjust the settings in the `build_msvc` directory and the `common.init.vcxproj` file. This project file contains settings that are common to all projects such as the runtime library version and target Windows SDK version. The Qt directories can also be set. To specify a non-default path to a static Qt package directory, use the `QTBASEDIR` environment variable.
-3. To build from the command-line with the Visual Studio 2019 toolchain use:
+3. To build from the command-line with the Visual Studio toolchain use:
```cmd
-msbuild -property:Configuration=Release -maxCpuCount -verbosity:minimal bitcoin.sln
+msbuild build_msvc\bitcoin.sln -property:Configuration=Release -maxCpuCount -verbosity:minimal
```
-Alternatively, open the `build_msvc/bitcoin.sln` file in Visual Studio 2019.
+Alternatively, open the `build_msvc/bitcoin.sln` file in Visual Studio.
Security
---------------------
diff --git a/build_msvc/msvc-autogen.py b/build_msvc/msvc-autogen.py
index 819fe1b7ae..c4ea598aa0 100755
--- a/build_msvc/msvc-autogen.py
+++ b/build_msvc/msvc-autogen.py
@@ -9,7 +9,7 @@ import argparse
from shutil import copyfile
SOURCE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'src'))
-DEFAULT_PLATFORM_TOOLSET = R'v142'
+DEFAULT_PLATFORM_TOOLSET = R'v143'
libs = [
'libbitcoin_cli',
@@ -93,7 +93,7 @@ def set_properties(vcxproj_filename, placeholder, content):
def main():
parser = argparse.ArgumentParser(description='Bitcoin-core msbuild configuration initialiser.')
parser.add_argument('-toolset', nargs='?', default=DEFAULT_PLATFORM_TOOLSET,
- help='Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019.'
+ help='Optionally sets the msbuild platform toolset, e.g. v142 for Visual Studio 2019, or v143 for Visual Studio 2022.'
' default is %s.'%DEFAULT_PLATFORM_TOOLSET)
args = parser.parse_args()
set_properties(os.path.join(SOURCE_DIR, '../build_msvc/common.init.vcxproj'), '@TOOLSET@', args.toolset)
diff --git a/ci/test/00_setup_env_mac_host.sh b/ci/test/00_setup_env_mac_native_x86_64.sh
index d176296e76..d176296e76 100755
--- a/ci/test/00_setup_env_mac_host.sh
+++ b/ci/test/00_setup_env_mac_native_x86_64.sh
diff --git a/configure.ac b/configure.ac
index 163f69988e..682923096d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1303,6 +1303,7 @@ if test "$enable_fuzz" = "yes"; then
bitcoin_enable_qt_test=no
bitcoin_enable_qt_dbus=no
use_bench=no
+ use_tests=no
use_external_signer=no
use_upnp=no
use_natpmp=no
@@ -1559,7 +1560,7 @@ fi
dnl libevent check
use_libevent=no
-if test "$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" != "nonononono"; then
+if test "$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$enable_fuzz_binary$use_tests$use_bench" != "nononononono"; then
PKG_CHECK_MODULES([EVENT], [libevent >= 2.1.8], [use_libevent=yes], [AC_MSG_ERROR([libevent version 2.1.8 or greater not found.])])
if test "$TARGET_OS" != "windows"; then
PKG_CHECK_MODULES([EVENT_PTHREADS], [libevent_pthreads >= 2.1.8], [], [AC_MSG_ERROR([libevent_pthreads version 2.1.8 or greater not found.])])
@@ -1846,8 +1847,8 @@ else
AC_MSG_RESULT([no])
fi
-if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_libs$build_bitcoind$bitcoin_enable_qt$use_bench$use_tests" = "nononononononono"; then
- AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui --enable-bench or --enable-tests])
+if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoin_libs$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-libs --with-daemon --with-gui --enable-fuzz(-binary) --enable-bench or --enable-tests])
fi
AM_CONDITIONAL([TARGET_DARWIN], [test "$TARGET_OS" = "darwin"])
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index 44c769f463..ad3129184c 100755
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -249,10 +249,6 @@ case "$HOST" in
*powerpc64*) HOST_LDFLAGS="${HOST_LDFLAGS} -Wl,--no-tls-get-addr-optimize" ;;
esac
-case "$HOST" in
- powerpc64-linux-*) HOST_LDFLAGS="${HOST_LDFLAGS} -Wl,-z,noexecstack" ;;
-esac
-
# Make $HOST-specific native binaries from depends available in $PATH
export PATH="${BASEPREFIX}/${HOST}/native/bin:${PATH}"
mkdir -p "$DISTSRC"
diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
index d35ad85e56..36d8dddab6 100644
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -200,10 +200,14 @@ chain for " target " development."))
(package-with-extra-patches base-nsis
(search-our-patches "nsis-gcc-10-memmove.patch")))
+(define (fix-ppc64-nx-default lief)
+ (package-with-extra-patches lief
+ (search-our-patches "lief-fix-ppc64-nx-default.patch")))
+
(define-public lief
(package
(name "python-lief")
- (version "0.12.0")
+ (version "0.12.1")
(source
(origin
(method git-fetch)
@@ -213,8 +217,15 @@ chain for " target " development."))
(file-name (git-file-name name version))
(sha256
(base32
- "026jchj56q25v6gc0754dj9cj5hz5zaza8ij93y5ga94w20kzm9q"))))
+ "1xzbh3bxy4rw1yamnx68da1v5s56ay4g081cyamv67256g0qy2i1"))))
(build-system python-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'parallel-jobs
+ ;; build with multiple cores
+ (lambda _
+ (substitute* "setup.py" (("self.parallel if self.parallel else 1") (number->string (parallel-job-count)))))))))
(native-inputs
`(("cmake" ,cmake)))
(home-page "https://github.com/lief-project/LIEF")
@@ -595,7 +606,7 @@ inspecting signatures in Mach-O binaries.")
;; Git
git
;; Tests
- lief)
+ (fix-ppc64-nx-default lief))
(let ((target (getenv "HOST")))
(cond ((string-suffix? "-mingw32" target)
;; Windows
diff --git a/contrib/guix/patches/lief-fix-ppc64-nx-default.patch b/contrib/guix/patches/lief-fix-ppc64-nx-default.patch
new file mode 100644
index 0000000000..101bc1ddc0
--- /dev/null
+++ b/contrib/guix/patches/lief-fix-ppc64-nx-default.patch
@@ -0,0 +1,29 @@
+Correct default for Binary::has_nx on ppc64
+
+From the Linux kernel source:
+
+ * This is the default if a program doesn't have a PT_GNU_STACK
+ * program header entry. The PPC64 ELF ABI has a non executable stack
+ * stack by default, so in the absence of a PT_GNU_STACK program header
+ * we turn execute permission off.
+
+This patch can be dropped the next time we update LIEF.
+
+diff --git a/src/ELF/Binary.cpp b/src/ELF/Binary.cpp
+index a90be1ab..fd2d9764 100644
+--- a/src/ELF/Binary.cpp
++++ b/src/ELF/Binary.cpp
+@@ -1084,7 +1084,12 @@ bool Binary::has_nx() const {
+ return segment->type() == SEGMENT_TYPES::PT_GNU_STACK;
+ });
+ if (it_stack == std::end(segments_)) {
+- return false;
++ if (header().machine_type() == ARCH::EM_PPC64) {
++ // The PPC64 ELF ABI has a non-executable stack by default.
++ return true;
++ } else {
++ return false;
++ }
+ }
+
+ return !(*it_stack)->has(ELF_SEGMENT_FLAGS::PF_X);
diff --git a/doc/build-unix.md b/doc/build-unix.md
index f02729ee32..bcfa25dc76 100644
--- a/doc/build-unix.md
+++ b/doc/build-unix.md
@@ -277,22 +277,17 @@ A list of additional configure flags can be displayed with:
Setup and Build Example: Arch Linux
-----------------------------------
-This example lists the steps necessary to setup and build a command line only, non-wallet distribution of the latest changes on Arch Linux:
+This example lists the steps necessary to setup and build a command line only distribution of the latest changes on Arch Linux:
- pacman -S git base-devel boost libevent python
+ pacman --sync --needed autoconf automake boost gcc git libevent libtool make pkgconf python sqlite
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin/
./autogen.sh
- ./configure --disable-wallet --without-gui --without-miniupnpc
+ ./configure
make check
+ ./src/bitcoind
-Note:
-Enabling wallet support requires either compiling against a Berkeley DB newer than 4.8 (package `db`) using `--with-incompatible-bdb`,
-or building and depending on a local version of Berkeley DB 4.8. The readily available Arch Linux packages are currently built using
-`--with-incompatible-bdb` according to the [PKGBUILD](https://github.com/archlinux/svntogit-community/blob/packages/bitcoin/trunk/PKGBUILD).
-As mentioned above, when maintaining portability of the wallet between the standard Bitcoin Core distributions and independently built
-node software is desired, Berkeley DB 4.8 must be used.
-
+If you intend to work with legacy Berkeley DB wallets, see [Berkeley DB](#berkeley-db) section.
ARM Cross-compilation
-------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index fa716af619..a3b975809b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1053,9 +1053,7 @@ include Makefile.leveldb.include
include Makefile.test_util.include
include Makefile.test_fuzz.include
-if ENABLE_TESTS
include Makefile.test.include
-endif
if ENABLE_BENCH
include Makefile.bench.include
diff --git a/src/Makefile.leveldb.include b/src/Makefile.leveldb.include
index 066f8940c5..bf14fe206b 100644
--- a/src/Makefile.leveldb.include
+++ b/src/Makefile.leveldb.include
@@ -13,7 +13,6 @@ LIBMEMENV = $(LIBMEMENV_INT)
LEVELDB_CPPFLAGS =
LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/include
-LEVELDB_CPPFLAGS += -I$(srcdir)/leveldb/helpers/memenv
LEVELDB_CPPFLAGS_INT =
LEVELDB_CPPFLAGS_INT += -I$(srcdir)/leveldb
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index ebd9e860cf..098feacb3d 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -6,7 +6,7 @@ if ENABLE_FUZZ_BINARY
noinst_PROGRAMS += test/fuzz/fuzz
endif
-if !ENABLE_FUZZ
+if ENABLE_TESTS
bin_PROGRAMS += test/test_bitcoin
endif
@@ -371,7 +371,7 @@ endif
endif
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
-if !ENABLE_FUZZ
+if ENABLE_TESTS
UNIVALUE_TESTS = univalue/test/object univalue/test/unitester univalue/test/no_nul
noinst_PROGRAMS += $(UNIVALUE_TESTS)
TESTS += $(UNIVALUE_TESTS)
diff --git a/src/coins.h b/src/coins.h
index de297dd427..67fecc9785 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -142,7 +142,6 @@ public:
virtual bool GetKey(COutPoint &key) const = 0;
virtual bool GetValue(Coin &coin) const = 0;
- virtual unsigned int GetValueSize() const = 0;
virtual bool Valid() const = 0;
virtual void Next() = 0;
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp
index a2f1f32780..d4a8e4f35a 100644
--- a/src/dbwrapper.cpp
+++ b/src/dbwrapper.cpp
@@ -10,7 +10,7 @@
#include <leveldb/cache.h>
#include <leveldb/env.h>
#include <leveldb/filter_policy.h>
-#include <memenv.h>
+#include <leveldb/helpers/memenv/memenv.h>
#include <stdint.h>
#include <algorithm>
diff --git a/src/dbwrapper.h b/src/dbwrapper.h
index 1109cb5888..cef8426d61 100644
--- a/src/dbwrapper.h
+++ b/src/dbwrapper.h
@@ -166,11 +166,6 @@ public:
}
return true;
}
-
- unsigned int GetValueSize() {
- return piter->value().size();
- }
-
};
class CDBWrapper
@@ -318,22 +313,6 @@ public:
pdb->GetApproximateSizes(&range, 1, &size);
return size;
}
-
- /**
- * Compact a certain range of keys in the database.
- */
- template<typename K>
- void CompactRange(const K& key_begin, const K& key_end) const
- {
- CDataStream ssKey1(SER_DISK, CLIENT_VERSION), ssKey2(SER_DISK, CLIENT_VERSION);
- ssKey1.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
- ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
- ssKey1 << key_begin;
- ssKey2 << key_end;
- leveldb::Slice slKey1((const char*)ssKey1.data(), ssKey1.size());
- leveldb::Slice slKey2((const char*)ssKey2.data(), ssKey2.size());
- pdb->CompactRange(&slKey1, &slKey2);
- }
};
#endif // BITCOIN_DBWRAPPER_H
diff --git a/src/i2p.cpp b/src/i2p.cpp
index caff8c1e69..8611984555 100644
--- a/src/i2p.cpp
+++ b/src/i2p.cpp
@@ -410,7 +410,7 @@ void Session::Disconnect()
Log("Destroying session %s", m_session_id);
}
}
- m_control_sock->Reset();
+ m_control_sock = std::make_unique<Sock>(INVALID_SOCKET);
m_session_id.clear();
}
} // namespace sam
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 751a03f01c..cbba1d0aa2 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -4075,6 +4075,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
tx_relay->m_relay_txs = true;
}
pfrom.m_bloom_filter_loaded = true;
+ pfrom.m_relays_txs = true;
}
return;
}
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index f11ddad30f..27d3a1b9e2 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -96,7 +96,11 @@ static void RegisterMetaTypes()
qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon");
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>("interfaces::BlockAndHeaderTipInfo");
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qRegisterMetaTypeStreamOperators<BitcoinUnit>("BitcoinUnit");
+#else
+ qRegisterMetaType<BitcoinUnit>("BitcoinUnit");
+#endif
}
static QString GetLangTerritory()
@@ -135,21 +139,30 @@ static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTrans
// - First load the translator for the base language, without territory
// - Then load the more specific locale translator
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
+ const QString translation_path{QLibraryInfo::location(QLibraryInfo::TranslationsPath)};
+#else
+ const QString translation_path{QLibraryInfo::path(QLibraryInfo::TranslationsPath)};
+#endif
// Load e.g. qt_de.qm
- if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ if (qtTranslatorBase.load("qt_" + lang, translation_path)) {
QApplication::installTranslator(&qtTranslatorBase);
+ }
// Load e.g. qt_de_DE.qm
- if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
+ if (qtTranslator.load("qt_" + lang_territory, translation_path)) {
QApplication::installTranslator(&qtTranslator);
+ }
// Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
- if (translatorBase.load(lang, ":/translations/"))
+ if (translatorBase.load(lang, ":/translations/")) {
QApplication::installTranslator(&translatorBase);
+ }
// Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
- if (translator.load(lang_territory, ":/translations/"))
+ if (translator.load(lang_territory, ":/translations/")) {
QApplication::installTranslator(&translator);
+ }
}
static bool InitSettings()
@@ -517,9 +530,11 @@ int GuiMain(int argc, char* argv[])
Q_INIT_RESOURCE(bitcoin);
Q_INIT_RESOURCE(bitcoin_locale);
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#endif
#if defined(QT_QPA_PLATFORM_ANDROID)
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index 97ec95a166..4ef53cac9a 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -661,6 +661,7 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
ret.pushKV("maxmempool", maxmempool);
ret.pushKV("mempoolminfee", ValueFromAmount(std::max(pool.GetMinFee(maxmempool), ::minRelayTxFee).GetFeePerK()));
ret.pushKV("minrelaytxfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()));
+ ret.pushKV("incrementalrelayfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK()));
ret.pushKV("unbroadcastcount", uint64_t{pool.GetUnbroadcastTxs().size()});
return ret;
}
@@ -668,7 +669,7 @@ UniValue MempoolInfoToJSON(const CTxMemPool& pool)
static RPCHelpMan getmempoolinfo()
{
return RPCHelpMan{"getmempoolinfo",
- "\nReturns details on the active state of the TX memory pool.\n",
+ "Returns details on the active state of the TX memory pool.",
{},
RPCResult{
RPCResult::Type::OBJ, "", "",
@@ -681,7 +682,8 @@ static RPCHelpMan getmempoolinfo()
{RPCResult::Type::NUM, "maxmempool", "Maximum memory usage for the mempool"},
{RPCResult::Type::STR_AMOUNT, "mempoolminfee", "Minimum fee rate in " + CURRENCY_UNIT + "/kvB for tx to be accepted. Is the maximum of minrelaytxfee and minimum mempool fee"},
{RPCResult::Type::STR_AMOUNT, "minrelaytxfee", "Current minimum relay fee for transactions"},
- {RPCResult::Type::NUM, "unbroadcastcount", "Current number of transactions that haven't passed initial broadcast yet"}
+ {RPCResult::Type::NUM, "incrementalrelayfee", "minimum fee rate increment for mempool limiting or BIP 125 replacement in " + CURRENCY_UNIT + "/kvB"},
+ {RPCResult::Type::NUM, "unbroadcastcount", "Current number of transactions that haven't passed initial broadcast yet"},
}},
RPCExamples{
HelpExampleCli("getmempoolinfo", "")
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
index 66ed18045e..e9987d73be 100644
--- a/src/rpc/server.cpp
+++ b/src/rpc/server.cpp
@@ -11,14 +11,18 @@
#include <util/strencodings.h>
#include <util/string.h>
#include <util/system.h>
+#include <util/time.h>
#include <boost/signals2/signal.hpp>
#include <cassert>
-#include <memory> // for unique_ptr
+#include <chrono>
+#include <memory>
#include <mutex>
#include <unordered_map>
+using SteadyClock = std::chrono::steady_clock;
+
static GlobalMutex g_rpc_warmup_mutex;
static std::atomic<bool> g_rpc_running{false};
static bool fRPCInWarmup GUARDED_BY(g_rpc_warmup_mutex) = true;
@@ -33,7 +37,7 @@ static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& req
struct RPCCommandExecutionInfo
{
std::string method;
- int64_t start;
+ SteadyClock::time_point start;
};
struct RPCServerInfo
@@ -50,7 +54,7 @@ struct RPCCommandExecution
explicit RPCCommandExecution(const std::string& method)
{
LOCK(g_rpc_server_info.mutex);
- it = g_rpc_server_info.active_commands.insert(g_rpc_server_info.active_commands.end(), {method, GetTimeMicros()});
+ it = g_rpc_server_info.active_commands.insert(g_rpc_server_info.active_commands.end(), {method, SteadyClock::now()});
}
~RPCCommandExecution()
{
@@ -231,7 +235,7 @@ static RPCHelpMan getrpcinfo()
for (const RPCCommandExecutionInfo& info : g_rpc_server_info.active_commands) {
UniValue entry(UniValue::VOBJ);
entry.pushKV("method", info.method);
- entry.pushKV("duration", GetTimeMicros() - info.start);
+ entry.pushKV("duration", int64_t{Ticks<std::chrono::microseconds>(SteadyClock::now() - info.start)});
active_commands.push_back(entry);
}
diff --git a/src/test/fuzz/util.cpp b/src/test/fuzz/util.cpp
index 883698aff1..8f5e771e37 100644
--- a/src/test/fuzz/util.cpp
+++ b/src/test/fuzz/util.cpp
@@ -24,10 +24,10 @@ FuzzedSock::FuzzedSock(FuzzedDataProvider& fuzzed_data_provider)
FuzzedSock::~FuzzedSock()
{
// Sock::~Sock() will be called after FuzzedSock::~FuzzedSock() and it will call
- // Sock::Reset() (not FuzzedSock::Reset()!) which will call CloseSocket(m_socket).
+ // close(m_socket) if m_socket is not INVALID_SOCKET.
// Avoid closing an arbitrary file descriptor (m_socket is just a random very high number which
// theoretically may concide with a real opened file descriptor).
- Reset();
+ m_socket = INVALID_SOCKET;
}
FuzzedSock& FuzzedSock::operator=(Sock&& other)
@@ -36,11 +36,6 @@ FuzzedSock& FuzzedSock::operator=(Sock&& other)
return *this;
}
-void FuzzedSock::Reset()
-{
- m_socket = INVALID_SOCKET;
-}
-
ssize_t FuzzedSock::Send(const void* data, size_t len, int flags) const
{
constexpr std::array send_errnos{
diff --git a/src/test/fuzz/util.h b/src/test/fuzz/util.h
index 66d00b1767..0819d326fd 100644
--- a/src/test/fuzz/util.h
+++ b/src/test/fuzz/util.h
@@ -55,8 +55,6 @@ public:
FuzzedSock& operator=(Sock&& other) override;
- void Reset() override;
-
ssize_t Send(const void* data, size_t len, int flags) const override;
ssize_t Recv(void* buf, size_t len, int flags) const override;
diff --git a/src/test/sock_tests.cpp b/src/test/sock_tests.cpp
index 9e98f4f0b1..01a402833d 100644
--- a/src/test/sock_tests.cpp
+++ b/src/test/sock_tests.cpp
@@ -69,24 +69,6 @@ BOOST_AUTO_TEST_CASE(move_assignment)
BOOST_CHECK(SocketIsClosed(s));
}
-BOOST_AUTO_TEST_CASE(release)
-{
- SOCKET s = CreateSocket();
- Sock* sock = new Sock(s);
- BOOST_CHECK_EQUAL(sock->Release(), s);
- delete sock;
- BOOST_CHECK(!SocketIsClosed(s));
- BOOST_REQUIRE(CloseSocket(s));
-}
-
-BOOST_AUTO_TEST_CASE(reset)
-{
- const SOCKET s = CreateSocket();
- Sock sock(s);
- sock.Reset();
- BOOST_CHECK(SocketIsClosed(s));
-}
-
#ifndef WIN32 // Windows does not have socketpair(2).
static void CreateSocketPair(int s[2])
diff --git a/src/test/util/net.h b/src/test/util/net.h
index 37d278645a..edb45d7c8e 100644
--- a/src/test/util/net.h
+++ b/src/test/util/net.h
@@ -100,7 +100,7 @@ public:
m_socket = INVALID_SOCKET - 1;
}
- ~StaticContentsSock() override { Reset(); }
+ ~StaticContentsSock() override { m_socket = INVALID_SOCKET; }
StaticContentsSock& operator=(Sock&& other) override
{
@@ -108,11 +108,6 @@ public:
return *this;
}
- void Reset() override
- {
- m_socket = INVALID_SOCKET;
- }
-
ssize_t Send(const void*, size_t len, int) const override { return len; }
ssize_t Recv(void* buf, size_t len, int flags) const override
diff --git a/src/txdb.cpp b/src/txdb.cpp
index a0939873ad..c048c2d92a 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -211,7 +211,6 @@ public:
bool GetKey(COutPoint &key) const override;
bool GetValue(Coin &coin) const override;
- unsigned int GetValueSize() const override;
bool Valid() const override;
void Next() override;
@@ -257,11 +256,6 @@ bool CCoinsViewDBCursor::GetValue(Coin &coin) const
return pcursor->GetValue(coin);
}
-unsigned int CCoinsViewDBCursor::GetValueSize() const
-{
- return pcursor->GetValueSize();
-}
-
bool CCoinsViewDBCursor::Valid() const
{
return keyTmp.first == DB_COIN;
diff --git a/src/util/sock.cpp b/src/util/sock.cpp
index 7d5069423a..1d44fbfdae 100644
--- a/src/util/sock.cpp
+++ b/src/util/sock.cpp
@@ -39,11 +39,11 @@ Sock::Sock(Sock&& other)
other.m_socket = INVALID_SOCKET;
}
-Sock::~Sock() { Reset(); }
+Sock::~Sock() { Close(); }
Sock& Sock::operator=(Sock&& other)
{
- Reset();
+ Close();
m_socket = other.m_socket;
other.m_socket = INVALID_SOCKET;
return *this;
@@ -51,15 +51,6 @@ Sock& Sock::operator=(Sock&& other)
SOCKET Sock::Get() const { return m_socket; }
-SOCKET Sock::Release()
-{
- const SOCKET s = m_socket;
- m_socket = INVALID_SOCKET;
- return s;
-}
-
-void Sock::Reset() { CloseSocket(m_socket); }
-
ssize_t Sock::Send(const void* data, size_t len, int flags) const
{
return send(m_socket, static_cast<const char*>(data), len, flags);
@@ -366,6 +357,22 @@ bool Sock::IsConnected(std::string& errmsg) const
}
}
+void Sock::Close()
+{
+ if (m_socket == INVALID_SOCKET) {
+ return;
+ }
+#ifdef WIN32
+ int ret = closesocket(m_socket);
+#else
+ int ret = close(m_socket);
+#endif
+ if (ret) {
+ LogPrintf("Error closing socket %d: %s\n", m_socket, NetworkErrorString(WSAGetLastError()));
+ }
+ m_socket = INVALID_SOCKET;
+}
+
#ifdef WIN32
std::string NetworkErrorString(int err)
{
@@ -389,19 +396,3 @@ std::string NetworkErrorString(int err)
return SysErrorString(err);
}
#endif
-
-bool CloseSocket(SOCKET& hSocket)
-{
- if (hSocket == INVALID_SOCKET)
- return false;
-#ifdef WIN32
- int ret = closesocket(hSocket);
-#else
- int ret = close(hSocket);
-#endif
- if (ret) {
- LogPrintf("Socket close failed: %d. Error: %s\n", hSocket, NetworkErrorString(WSAGetLastError()));
- }
- hSocket = INVALID_SOCKET;
- return ret != SOCKET_ERROR;
-}
diff --git a/src/util/sock.h b/src/util/sock.h
index 3245820995..5ca5f1b91b 100644
--- a/src/util/sock.h
+++ b/src/util/sock.h
@@ -69,18 +69,6 @@ public:
[[nodiscard]] virtual SOCKET Get() const;
/**
- * Get the value of the contained socket and drop ownership. It will not be closed by the
- * destructor after this call.
- * @return socket or INVALID_SOCKET if empty
- */
- virtual SOCKET Release();
-
- /**
- * Close if non-empty.
- */
- virtual void Reset();
-
- /**
* send(2) wrapper. Equivalent to `send(this->Get(), data, len, flags);`. Code that uses this
* wrapper can be unit tested if this method is overridden by a mock Sock implementation.
*/
@@ -252,12 +240,15 @@ protected:
* Contained socket. `INVALID_SOCKET` designates the object is empty.
*/
SOCKET m_socket;
+
+private:
+ /**
+ * Close `m_socket` if it is not `INVALID_SOCKET`.
+ */
+ void Close();
};
/** Return readable error string for a network error code */
std::string NetworkErrorString(int err);
-/** Close socket and set hSocket to INVALID_SOCKET */
-bool CloseSocket(SOCKET& hSocket);
-
#endif // BITCOIN_UTIL_SOCK_H
diff --git a/src/util/time.h b/src/util/time.h
index ad91a72860..1a381aab9d 100644
--- a/src/util/time.h
+++ b/src/util/time.h
@@ -40,10 +40,15 @@ void UninterruptibleSleep(const std::chrono::microseconds& n);
* This helper is used to convert durations/time_points before passing them over an
* interface that doesn't support std::chrono (e.g. RPC, debug log, or the GUI)
*/
+template <typename Dur1, typename Dur2>
+constexpr auto Ticks(Dur2 d)
+{
+ return std::chrono::duration_cast<Dur1>(d).count();
+}
template <typename Duration, typename Timepoint>
constexpr auto TicksSinceEpoch(Timepoint t)
{
- return std::chrono::time_point_cast<Duration>(t).time_since_epoch().count();
+ return Ticks<Duration>(t.time_since_epoch());
}
constexpr int64_t count_seconds(std::chrono::seconds t) { return t.count(); }
constexpr int64_t count_milliseconds(std::chrono::milliseconds t) { return t.count(); }
diff --git a/test/functional/feature_rbf.py b/test/functional/feature_rbf.py
index 738c6ea4af..712897e5e7 100755
--- a/test/functional/feature_rbf.py
+++ b/test/functional/feature_rbf.py
@@ -711,6 +711,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
# Higher fee, higher feerate, different txid, but the replacement does not provide a relay
# fee conforming to node's `incrementalrelayfee` policy of 1000 sat per KB.
+ assert_equal(self.nodes[0].getmempoolinfo()["incrementalrelayfee"], Decimal("0.00001"))
tx.vout[0].nValue -= 1
assert_raises_rpc_error(-26, "insufficient fee", self.nodes[0].sendrawtransaction, tx.serialize().hex())
diff --git a/test/functional/feature_signet.py b/test/functional/feature_signet.py
index 6578caee3f..4c1e48af6d 100755
--- a/test/functional/feature_signet.py
+++ b/test/functional/feature_signet.py
@@ -39,6 +39,14 @@ class SignetBasicTest(BitcoinTestFramework):
shared_args3, shared_args3,
]
+ def setup_network(self):
+ self.setup_nodes()
+
+ # Setup the three signets, which are incompatible with each other
+ self.connect_nodes(0, 1)
+ self.connect_nodes(2, 3)
+ self.connect_nodes(4, 5)
+
def run_test(self):
self.log.info("basic tests using OP_TRUE challenge")
diff --git a/test/functional/p2p_permissions.py b/test/functional/p2p_permissions.py
index 1dc3a5b9a0..185011c2df 100755
--- a/test/functional/p2p_permissions.py
+++ b/test/functional/p2p_permissions.py
@@ -91,6 +91,7 @@ class P2PPermissionsTests(BitcoinTestFramework):
self.nodes[1].assert_start_raises_init_error(["-whitelist=oopsie@127.0.0.1"], "Invalid P2P permission", match=ErrorMatch.PARTIAL_REGEX)
self.nodes[1].assert_start_raises_init_error(["-whitelist=noban@127.0.0.1:230"], "Invalid netmask specified in", match=ErrorMatch.PARTIAL_REGEX)
self.nodes[1].assert_start_raises_init_error(["-whitebind=noban@127.0.0.1/10"], "Cannot resolve -whitebind address", match=ErrorMatch.PARTIAL_REGEX)
+ self.nodes[1].assert_start_raises_init_error(["-whitebind=noban@127.0.0.1", "-bind=127.0.0.1", "-listen=0"], "Cannot set -bind or -whitebind together with -listen=0", match=ErrorMatch.PARTIAL_REGEX)
def check_tx_relay(self):
block_op_true = self.nodes[0].getblock(self.generatetoaddress(self.nodes[0], 100, ADDRESS_BCRT1_P2WSH_OP_TRUE)[0])
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 3f02d21d42..c880aabd21 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -581,6 +581,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def connect_nodes(self, a, b):
from_connection = self.nodes[a]
to_connection = self.nodes[b]
+ from_num_peers = 1 + len(from_connection.getpeerinfo())
+ to_num_peers = 1 + len(to_connection.getpeerinfo())
ip_port = "127.0.0.1:" + str(p2p_port(b))
from_connection.addnode(ip_port, "onetry")
# poll until version handshake complete to avoid race conditions
@@ -588,10 +590,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# See comments in net_processing:
# * Must have a version message before anything else
# * Must have a verack message before anything else
- wait_until_helper(lambda: all(peer['version'] != 0 for peer in from_connection.getpeerinfo()))
- wait_until_helper(lambda: all(peer['version'] != 0 for peer in to_connection.getpeerinfo()))
- wait_until_helper(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()))
- wait_until_helper(lambda: all(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in to_connection.getpeerinfo()))
+ self.wait_until(lambda: sum(peer['version'] != 0 for peer in from_connection.getpeerinfo()) == from_num_peers)
+ self.wait_until(lambda: sum(peer['version'] != 0 for peer in to_connection.getpeerinfo()) == to_num_peers)
+ self.wait_until(lambda: sum(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in from_connection.getpeerinfo()) == from_num_peers)
+ self.wait_until(lambda: sum(peer['bytesrecv_per_msg'].pop('verack', 0) == 24 for peer in to_connection.getpeerinfo()) == to_num_peers)
def disconnect_nodes(self, a, b):
def disconnect_nodes_helper(from_connection, node_num):
@@ -620,7 +622,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
raise
# wait to disconnect
- wait_until_helper(lambda: not get_peer_ids(), timeout=5)
+ self.wait_until(lambda: not get_peer_ids(), timeout=5)
disconnect_nodes_helper(self.nodes[a], b)
diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py
index ac74ff2484..ff11f421a1 100755
--- a/test/functional/wallet_importdescriptors.py
+++ b/test/functional/wallet_importdescriptors.py
@@ -454,7 +454,7 @@ class ImportDescriptorsTest(BitcoinTestFramework):
send_txid = wmulti_priv.sendtoaddress(w0.getnewaddress(), 8)
decoded = wmulti_priv.gettransaction(txid=send_txid, verbose=True)['decoded']
assert_equal(len(decoded['vin'][0]['txinwitness']), 4)
- self.generate(self.nodes[0], 6)
+ self.sync_all()
self.nodes[1].createwallet(wallet_name="wmulti_pub", disable_private_keys=True, blank=True, descriptors=True)
wmulti_pub = self.nodes[1].get_wallet_rpc("wmulti_pub")