From 35d2d0679782581cbbf05babc59f0f28858a9b72 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 26 Jan 2026 12:20:40 +0000 Subject: [PATCH 1/5] cmake: remove libevent Also remove raii_event_tests. --- CMakeLists.txt | 4 -- cmake/module/FindLibevent.cmake | 86 ------------------------------- src/CMakeLists.txt | 3 -- src/support/events.h | 43 ---------------- src/test/CMakeLists.txt | 2 - src/test/fuzz/CMakeLists.txt | 1 - src/test/raii_event_tests.cpp | 91 --------------------------------- 7 files changed, 230 deletions(-) delete mode 100644 cmake/module/FindLibevent.cmake delete mode 100644 src/support/events.h delete mode 100644 src/test/raii_event_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 69ee54611a4..69db01f2755 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,10 +221,6 @@ target_link_libraries(core_interface INTERFACE include(AddBoostIfNeeded) add_boost_if_needed() -if(BUILD_DAEMON OR BUILD_GUI OR BUILD_CLI OR BUILD_TESTS OR BUILD_BENCH OR BUILD_FUZZ_BINARY) - find_package(Libevent 2.1.8 MODULE REQUIRED) -endif() - if(ENABLE_WALLET) if(VCPKG_TARGET_TRIPLET) # Use of the `unofficial::` namespace is a vcpkg package manager convention. diff --git a/cmake/module/FindLibevent.cmake b/cmake/module/FindLibevent.cmake deleted file mode 100644 index c006b43d604..00000000000 --- a/cmake/module/FindLibevent.cmake +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) 2024-present The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or https://opensource.org/license/mit/. - -#[=======================================================================[ -FindLibevent ------------- - -Finds the Libevent headers and libraries. - -This is a wrapper around find_package()/pkg_check_modules() commands that: - - facilitates searching in various build environments - - prints a standard log message - -#]=======================================================================] - -# Check whether evhttp_connection_get_peer expects const char**. -# See https://github.com/libevent/libevent/commit/a18301a2bb160ff7c3ffaf5b7653c39ffe27b385 -function(check_evhttp_connection_get_peer target) - include(CMakePushCheckState) - cmake_push_check_state(RESET) - set(CMAKE_REQUIRED_LIBRARIES ${target}) - include(CheckCXXSourceCompiles) - check_cxx_source_compiles(" - #include - #include - - int main() - { - evhttp_connection* conn = (evhttp_connection*)1; - const char* host; - uint16_t port; - evhttp_connection_get_peer(conn, &host, &port); - } - " HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR - ) - cmake_pop_check_state() - target_compile_definitions(${target} INTERFACE - $<$:HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR> - ) -endfunction() - -set(_libevent_components core extra) -if(NOT WIN32) - list(APPEND _libevent_components pthreads) -endif() - -find_package(Libevent ${Libevent_FIND_VERSION} QUIET - NO_MODULE -) - -include(FindPackageHandleStandardArgs) -if(Libevent_FOUND) - find_package(Libevent ${Libevent_FIND_VERSION} QUIET - REQUIRED COMPONENTS ${_libevent_components} - NO_MODULE - ) - find_package_handle_standard_args(Libevent - REQUIRED_VARS Libevent_DIR - VERSION_VAR Libevent_VERSION - ) - check_evhttp_connection_get_peer(libevent::extra) -else() - find_package(PkgConfig REQUIRED) - foreach(component IN LISTS _libevent_components) - pkg_check_modules(libevent_${component} - REQUIRED QUIET - IMPORTED_TARGET GLOBAL - libevent_${component}>=${Libevent_FIND_VERSION} - ) - if(TARGET PkgConfig::libevent_${component} AND NOT TARGET libevent::${component}) - add_library(libevent::${component} ALIAS PkgConfig::libevent_${component}) - endif() - endforeach() - find_package_handle_standard_args(Libevent - REQUIRED_VARS libevent_core_LIBRARY_DIRS - VERSION_VAR libevent_core_VERSION - ) - check_evhttp_connection_get_peer(PkgConfig::libevent_extra) -endif() - -unset(_libevent_components) - -mark_as_advanced(Libevent_DIR) -mark_as_advanced(_event_h) -mark_as_advanced(_event_lib) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 524c28165cc..8c0977f0882 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -290,9 +290,6 @@ target_link_libraries(bitcoin_node minisketch univalue Boost::headers - $ - $ - $ $ ) if(WITH_EMBEDDED_ASMAP) diff --git a/src/support/events.h b/src/support/events.h deleted file mode 100644 index a118ba32b5b..00000000000 --- a/src/support/events.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2016-present The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#ifndef BITCOIN_SUPPORT_EVENTS_H -#define BITCOIN_SUPPORT_EVENTS_H - -#include -#include - -#include -#include - -#define MAKE_RAII(type) \ -/* deleter */\ -struct type##_deleter {\ - void operator()(struct type* ob) {\ - type##_free(ob);\ - }\ -};\ -/* unique ptr typedef */\ -typedef std::unique_ptr raii_##type - -MAKE_RAII(event_base); -MAKE_RAII(event); -MAKE_RAII(evhttp); - -inline raii_event_base obtain_event_base() { - auto result = raii_event_base(event_base_new()); - if (!result.get()) - throw std::runtime_error("cannot create event_base"); - return result; -} - -inline raii_event obtain_event(struct event_base* base, evutil_socket_t s, short events, event_callback_fn cb, void* arg) { - return raii_event(event_new(base, s, events, cb, arg)); -} - -inline raii_evhttp obtain_evhttp(struct event_base* base) { - return raii_evhttp(evhttp_new(base)); -} - -#endif // BITCOIN_SUPPORT_EVENTS_H diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index a25d9f900a6..e56190649f4 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -82,7 +82,6 @@ add_executable(test_bitcoin prevector_tests.cpp private_broadcast_tests.cpp psbt_tests.cpp - raii_event_tests.cpp random_tests.cpp rbf_tests.cpp rest_tests.cpp @@ -168,7 +167,6 @@ target_link_libraries(test_bitcoin minisketch secp256k1 Boost::headers - libevent::extra $ ) diff --git a/src/test/fuzz/CMakeLists.txt b/src/test/fuzz/CMakeLists.txt index a159ef7e11c..2d1fa3b78d6 100644 --- a/src/test/fuzz/CMakeLists.txt +++ b/src/test/fuzz/CMakeLists.txt @@ -154,7 +154,6 @@ target_link_libraries(fuzz univalue secp256k1 Boost::headers - libevent::extra ) if(ENABLE_WALLET) diff --git a/src/test/raii_event_tests.cpp b/src/test/raii_event_tests.cpp deleted file mode 100644 index 3a797dff8bc..00000000000 --- a/src/test/raii_event_tests.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2016-present The Bitcoin Core developers -// Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. - -#include - -#include -#include - -#include - -#include - -#include - -BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup) - -#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED - -static std::map tags; -static std::map orders; -static uint16_t tagSequence = 0; - -static void* tag_malloc(size_t sz) { - void* mem = malloc(sz); - if (!mem) return mem; - tags[mem]++; - orders[mem] = tagSequence++; - return mem; -} - -static void tag_free(void* mem) { - tags[mem]--; - orders[mem] = tagSequence++; - free(mem); -} - -BOOST_AUTO_TEST_CASE(raii_event_creation) -{ - event_set_mem_functions(tag_malloc, realloc, tag_free); - - void* base_ptr = nullptr; - { - auto base = obtain_event_base(); - base_ptr = (void*)base.get(); - BOOST_CHECK(tags[base_ptr] == 1); - } - BOOST_CHECK(tags[base_ptr] == 0); - - void* event_ptr = nullptr; - { - auto base = obtain_event_base(); - auto event = obtain_event(base.get(), -1, 0, nullptr, nullptr); - - base_ptr = (void*)base.get(); - event_ptr = (void*)event.get(); - - BOOST_CHECK(tags[base_ptr] == 1); - BOOST_CHECK(tags[event_ptr] == 1); - } - BOOST_CHECK(tags[base_ptr] == 0); - BOOST_CHECK(tags[event_ptr] == 0); - - event_set_mem_functions(malloc, realloc, free); -} - -BOOST_AUTO_TEST_CASE(raii_event_order) -{ - event_set_mem_functions(tag_malloc, realloc, tag_free); - - void* base_ptr = nullptr; - void* event_ptr = nullptr; - { - auto base = obtain_event_base(); - auto event = obtain_event(base.get(), -1, 0, nullptr, nullptr); - - base_ptr = (void*)base.get(); - event_ptr = (void*)event.get(); - - // base should have allocated before event - BOOST_CHECK(orders[base_ptr] < orders[event_ptr]); - } - // base should be freed after event - BOOST_CHECK(orders[base_ptr] > orders[event_ptr]); - - event_set_mem_functions(malloc, realloc, free); -} - -#endif // EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED - -BOOST_AUTO_TEST_SUITE_END() From a0ca249f3fc8a678855925a83d508073916e0f79 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 26 Jan 2026 12:22:41 +0000 Subject: [PATCH 2/5] depends: remove libevent --- depends/Makefile | 5 +- depends/README.md | 1 - depends/packages/libevent.mk | 46 -------- depends/packages/packages.mk | 2 - depends/patches/libevent/cmake_fixups.patch | 13 --- depends/patches/libevent/netbsd_fixup.patch | 23 ---- depends/patches/libevent/winver_fixup.patch | 122 -------------------- 7 files changed, 1 insertion(+), 211 deletions(-) delete mode 100644 depends/packages/libevent.mk delete mode 100644 depends/patches/libevent/cmake_fixups.patch delete mode 100644 depends/patches/libevent/netbsd_fixup.patch delete mode 100644 depends/patches/libevent/winver_fixup.patch diff --git a/depends/Makefile b/depends/Makefile index c377187b50a..b55ac440b43 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -35,7 +35,6 @@ WORK_PATH = $(BASEDIR)/work BASE_CACHE ?= $(BASEDIR)/built SDK_PATH ?= $(BASEDIR)/SDKs NO_BOOST ?= -NO_LIBEVENT ?= NO_QT ?= NO_QR ?= NO_WALLET ?= @@ -154,8 +153,6 @@ $(host_arch)_$(host_os)_id:=$(shell env CC='$(host_CC)' C_STANDARD='$(C_STANDARD boost_packages_$(NO_BOOST) = $(boost_packages) -libevent_packages_$(NO_LIBEVENT) = $(libevent_packages) - qrencode_packages_$(NO_QR) = $(qrencode_$(host_os)_packages) qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages) $(qt_$(host_arch)_$(host_os)_packages) $(qrencode_packages_) @@ -167,7 +164,7 @@ zmq_packages_$(NO_ZMQ) = $(zmq_packages) ipc_packages_$(NO_IPC) = $(ipc_packages) usdt_packages_$(NO_USDT) = $(usdt_$(host_os)_packages) -packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(libevent_packages_) $(qt_packages_) $(wallet_packages_) $(usdt_packages_) +packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(boost_packages_) $(qt_packages_) $(wallet_packages_) $(usdt_packages_) native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_) ifneq ($(zmq_packages_),) diff --git a/depends/README.md b/depends/README.md index b12df1354e5..b7d7d2263fb 100644 --- a/depends/README.md +++ b/depends/README.md @@ -90,7 +90,6 @@ The following can be set when running make: `make FOO=bar` - `C_STANDARD`: Set the C standard version used. Defaults to `c11`. - `CXX_STANDARD`: Set the C++ standard version used. Defaults to `c++20`. - `NO_BOOST`: Don't download/build/cache Boost -- `NO_LIBEVENT`: Don't download/build/cache Libevent - `NO_QT`: Don't download/build/cache Qt and its dependencies - `NO_QR`: Don't download/build/cache packages needed for enabling qrencode - `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk deleted file mode 100644 index 33eeed55274..00000000000 --- a/depends/packages/libevent.mk +++ /dev/null @@ -1,46 +0,0 @@ -package=libevent -$(package)_version=2.1.12-stable -$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/ -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb -$(package)_patches=cmake_fixups.patch -$(package)_patches += netbsd_fixup.patch -$(package)_patches += winver_fixup.patch -$(package)_build_subdir=build - -# When building for Windows, we set _WIN32_WINNT to target the same Windows -# version as we do in releases. Due to quirks in libevents build system, this -# is also required to enable support for ipv6. See #19375. -define $(package)_set_vars - $(package)_config_opts=-DCMAKE_BUILD_TYPE=None -DEVENT__DISABLE_BENCHMARK=ON -DEVENT__DISABLE_OPENSSL=ON - $(package)_config_opts+=-DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_REGRESS=ON - $(package)_config_opts+=-DEVENT__DISABLE_TESTS=ON -DEVENT__LIBRARY_TYPE=STATIC - $(package)_cflags += -fdebug-prefix-map=$($(package)_extract_dir)=/usr -fmacro-prefix-map=$($(package)_extract_dir)=/usr - $(package)_cppflags += -D_GNU_SOURCE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 - $(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0A00 -endef - -define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \ - patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch && \ - patch -p1 < $($(package)_patch_dir)/winver_fixup.patch -endef - -define $(package)_config_cmds - $($(package)_cmake) -S .. -B . -endef - -define $(package)_build_cmds - $(MAKE) -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install -endef - -define $(package)_postprocess_cmds - rm -rf bin lib/pkgconfig && \ - rm include/ev*.h && \ - rm include/event2/*_compat.h && \ - rm lib/libevent.a -endef diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 22ae4787fe7..a53843317b7 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -2,8 +2,6 @@ packages:= boost_packages = boost -libevent_packages = libevent - qrencode_linux_packages = qrencode qrencode_freebsd_packages = qrencode qrencode_darwin_packages = qrencode diff --git a/depends/patches/libevent/cmake_fixups.patch b/depends/patches/libevent/cmake_fixups.patch deleted file mode 100644 index a8812afd1e1..00000000000 --- a/depends/patches/libevent/cmake_fixups.patch +++ /dev/null @@ -1,13 +0,0 @@ -cmake: set minimum version to 3.5 - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,7 +19,7 @@ - # start libevent.sln - # - --cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -+cmake_minimum_required(VERSION 3.5 FATAL_ERROR) - - if (POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) diff --git a/depends/patches/libevent/netbsd_fixup.patch b/depends/patches/libevent/netbsd_fixup.patch deleted file mode 100644 index 21d96aaf452..00000000000 --- a/depends/patches/libevent/netbsd_fixup.patch +++ /dev/null @@ -1,23 +0,0 @@ -Improve portability on NetBSD - -According to GCC documentation, "the various `-std` options disable -certain keywords". -This change adheres to GCC's recommendation by replacing the `typeof` -keyword with its alternative, `__typeof__`. - -See https://github.com/libevent/libevent/commit/1759485e9a59147a47a674f5132fcfe764e7748c. - - ---- a/kqueue.c -+++ b/kqueue.c -@@ -52,8 +52,8 @@ - * intptr_t, whereas others define it as void*. There doesn't seem to be an - * easy way to tell them apart via autoconf, so we need to use OS macros. */ - #if defined(__NetBSD__) --#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x)) --#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x)) -+#define PTR_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(x)) -+#define INT_TO_UDATA(x) ((__typeof__(((struct kevent *)0)->udata))(intptr_t)(x)) - #elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__) - #define PTR_TO_UDATA(x) ((intptr_t)(x)) - #define INT_TO_UDATA(x) ((intptr_t)(x)) diff --git a/depends/patches/libevent/winver_fixup.patch b/depends/patches/libevent/winver_fixup.patch deleted file mode 100644 index 4995c356f94..00000000000 --- a/depends/patches/libevent/winver_fixup.patch +++ /dev/null @@ -1,122 +0,0 @@ -Cherry-picked from a14ff91254f40cf36e0fee199e26fb11260fab49. - -move _WIN32_WINNT defintions before first #include - -_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined -before the windows.h is included for the first time. -Avoid the confusion of indirect #include by defining -before any. - -diff --git a/event_iocp.c b/event_iocp.c -index 6b2a2e15..4955e426 100644 ---- a/event_iocp.c -+++ b/event_iocp.c -@@ -23,12 +23,14 @@ - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ --#include "evconfig-private.h" - - #ifndef _WIN32_WINNT - /* Minimum required for InitializeCriticalSectionAndSpinCount */ - #define _WIN32_WINNT 0x0403 - #endif -+ -+#include "evconfig-private.h" -+ - #include - #include - #include -diff --git a/evthread_win32.c b/evthread_win32.c -index 2ec80560..8647f72b 100644 ---- a/evthread_win32.c -+++ b/evthread_win32.c -@@ -23,18 +23,21 @@ - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ --#include "event2/event-config.h" --#include "evconfig-private.h" - - #ifdef _WIN32 - #ifndef _WIN32_WINNT - /* Minimum required for InitializeCriticalSectionAndSpinCount */ - #define _WIN32_WINNT 0x0403 - #endif --#include - #define WIN32_LEAN_AND_MEAN -+#endif -+ -+#include "event2/event-config.h" -+#include "evconfig-private.h" -+ -+#ifdef _WIN32 -+#include - #include --#undef WIN32_LEAN_AND_MEAN - #include - #endif - -diff --git a/evutil.c b/evutil.c -index 9817f086..8537ffe8 100644 ---- a/evutil.c -+++ b/evutil.c -@@ -24,6 +24,14 @@ - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -+#ifdef _WIN32 -+#ifndef _WIN32_WINNT -+/* For structs needed by GetAdaptersAddresses */ -+#define _WIN32_WINNT 0x0501 -+#endif -+#define WIN32_LEAN_AND_MEAN -+#endif -+ - #include "event2/event-config.h" - #include "evconfig-private.h" - -@@ -31,15 +39,10 @@ - #include - #include - #include --#define WIN32_LEAN_AND_MEAN - #include --#undef WIN32_LEAN_AND_MEAN - #include - #include - #include --#undef _WIN32_WINNT --/* For structs needed by GetAdaptersAddresses */ --#define _WIN32_WINNT 0x0501 - #include - #include - #endif -diff --git a/listener.c b/listener.c -index f5c00c9c..d1080e76 100644 ---- a/listener.c -+++ b/listener.c -@@ -24,16 +24,19 @@ - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -+#ifdef _WIN32 -+#ifndef _WIN32_WINNT -+/* Minimum required for InitializeCriticalSectionAndSpinCount */ -+#define _WIN32_WINNT 0x0403 -+#endif -+#endif -+ - #include "event2/event-config.h" - #include "evconfig-private.h" - - #include - - #ifdef _WIN32 --#ifndef _WIN32_WINNT --/* Minimum required for InitializeCriticalSectionAndSpinCount */ --#define _WIN32_WINNT 0x0403 --#endif - #include - #include - #include From 0443943dc03e9892937355b543eb410477aba135 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 26 Jan 2026 12:24:01 +0000 Subject: [PATCH 3/5] ci: remove libevent --- .github/workflows/ci.yml | 4 ++-- ci/test/00_setup_env_native_asan.sh | 2 +- ci/test/00_setup_env_native_fuzz.sh | 2 +- ci/test/00_setup_env_native_fuzz_with_valgrind.sh | 2 +- ci/test/00_setup_env_native_iwyu.sh | 2 +- ci/test/00_setup_env_native_tidy.sh | 2 +- ci/test/00_setup_env_native_valgrind.sh | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d28e4167cb0..bf8da3b0761 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,7 +96,7 @@ jobs: git config user.name "CI" - run: | sudo apt-get update - sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libevent-dev libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y + sudo apt-get install clang mold ccache build-essential cmake ninja-build pkgconf python3-zmq libboost-dev libsqlite3-dev systemtap-sdt-dev libzmq3-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev capnproto libcapnp-dev -y sudo pip3 install --break-system-packages pycapnp - name: Compile and run tests run: | @@ -159,7 +159,7 @@ jobs: run: | # A workaround for "The `brew link` step did not complete successfully" error. brew install --quiet python@3 || brew link --overwrite python@3 - brew install --quiet coreutils ninja pkgconf ccache boost libevent zeromq qt@6 qrencode capnp + brew install --quiet coreutils ninja pkgconf ccache boost zeromq qt@6 qrencode capnp - name: Set Ccache directory run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV" diff --git a/ci/test/00_setup_env_native_asan.sh b/ci/test/00_setup_env_native_asan.sh index 58be89fa104..7e28b05e0b0 100755 --- a/ci/test/00_setup_env_native_asan.sh +++ b/ci/test/00_setup_env_native_asan.sh @@ -20,7 +20,7 @@ fi export CONTAINER_NAME=ci_native_asan export APT_LLVM_V="22" -export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev mold python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libevent-dev libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto python3-pip" +export PACKAGES="systemtap-sdt-dev clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev mold python3-zmq qt6-base-dev qt6-tools-dev qt6-l10n-tools libboost-dev libzmq3-dev libqrencode-dev libsqlite3-dev ${BPFCC_PACKAGE} libcapnp-dev capnproto python3-pip" export PIP_PACKAGES="--break-system-packages pycapnp" export NO_DEPENDS=1 export GOAL="install" diff --git a/ci/test/00_setup_env_native_fuzz.sh b/ci/test/00_setup_env_native_fuzz.sh index 276ce08d056..bb203a72850 100755 --- a/ci/test/00_setup_env_native_fuzz.sh +++ b/ci/test/00_setup_env_native_fuzz.sh @@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" export CONTAINER_NAME=ci_native_fuzz export APT_LLVM_V="22" -export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libevent-dev libboost-dev libsqlite3-dev libcapnp-dev capnproto" +export PACKAGES="clang-${APT_LLVM_V} llvm-${APT_LLVM_V} libclang-rt-${APT_LLVM_V}-dev libboost-dev libsqlite3-dev libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false diff --git a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh index 8020ea43da7..b6442c78fb8 100755 --- a/ci/test/00_setup_env_native_fuzz_with_valgrind.sh +++ b/ci/test/00_setup_env_native_fuzz_with_valgrind.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" export CONTAINER_NAME=ci_native_fuzz_valgrind -export PACKAGES="clang llvm libclang-rt-dev libevent-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto" +export PACKAGES="clang llvm libclang-rt-dev libboost-dev libsqlite3-dev valgrind libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false diff --git a/ci/test/00_setup_env_native_iwyu.sh b/ci/test/00_setup_env_native_iwyu.sh index 3a26be56e7e..14c367bb31c 100755 --- a/ci/test/00_setup_env_native_iwyu.sh +++ b/ci/test/00_setup_env_native_iwyu.sh @@ -10,7 +10,7 @@ export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" # To build codegen, CMake export CONTAINER_NAME=ci_native_iwyu export IWYU_LLVM_V="22" export APT_LLVM_V="${IWYU_LLVM_V}" -export PACKAGES="clang-${IWYU_LLVM_V} clang-format-${IWYU_LLVM_V} libclang-${IWYU_LLVM_V}-dev llvm-${IWYU_LLVM_V}-dev jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" +export PACKAGES="clang-${IWYU_LLVM_V} clang-format-${IWYU_LLVM_V} libclang-${IWYU_LLVM_V}-dev llvm-${IWYU_LLVM_V}-dev jq libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false diff --git a/ci/test/00_setup_env_native_tidy.sh b/ci/test/00_setup_env_native_tidy.sh index 5cebb8cd8ca..845a43705b7 100755 --- a/ci/test/00_setup_env_native_tidy.sh +++ b/ci/test/00_setup_env_native_tidy.sh @@ -10,7 +10,7 @@ export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" export CONTAINER_NAME=ci_native_tidy export TIDY_LLVM_V="22" export APT_LLVM_V="${TIDY_LLVM_V}" -export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libevent-dev libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" +export PACKAGES="clang-${TIDY_LLVM_V} libclang-${TIDY_LLVM_V}-dev llvm-${TIDY_LLVM_V}-dev libomp-${TIDY_LLVM_V}-dev clang-tidy-${TIDY_LLVM_V} jq libboost-dev libzmq3-dev systemtap-sdt-dev qt6-base-dev qt6-tools-dev qt6-l10n-tools libqrencode-dev libsqlite3-dev libcapnp-dev capnproto" export NO_DEPENDS=1 export RUN_UNIT_TESTS=false export RUN_FUNCTIONAL_TESTS=false diff --git a/ci/test/00_setup_env_native_valgrind.sh b/ci/test/00_setup_env_native_valgrind.sh index ba9d5b404aa..52b5a37bfa3 100755 --- a/ci/test/00_setup_env_native_valgrind.sh +++ b/ci/test/00_setup_env_native_valgrind.sh @@ -8,7 +8,7 @@ export LC_ALL=C.UTF-8 export CI_IMAGE_NAME_TAG="mirror.gcr.io/ubuntu:26.04" export CONTAINER_NAME=ci_native_valgrind -export PACKAGES="clang llvm libclang-rt-dev valgrind python3-zmq libevent-dev libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip" +export PACKAGES="clang llvm libclang-rt-dev valgrind python3-zmq libboost-dev libzmq3-dev libsqlite3-dev libcapnp-dev capnproto python3-pip" export PIP_PACKAGES="--break-system-packages pycapnp" export USE_VALGRIND=1 export NO_DEPENDS=1 From 96d7f55f1dfbad4ae4991b7154e5d916b00d4687 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 26 Jan 2026 12:24:21 +0000 Subject: [PATCH 4/5] vcpkg: remove libevent --- vcpkg.json | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index 49906808c8f..99ad6eb00ca 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,8 +3,7 @@ "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "builtin-baseline": "120deac3062162151622ca4860575a33844ba10b", "dependencies": [ - "boost-multi-index", - "libevent" + "boost-multi-index" ], "default-features": [ "qt", @@ -49,12 +48,5 @@ "zeromq" ] } - }, - "overrides": [ - { - "$comment": "Newer unreleased libevent versions cause https://github.com/bitcoin/bitcoin/issues/30096", - "name": "libevent", - "version": "2.1.12#7" - } - ] + } } From 146b3adfaa19070ff88b202df865bb9fca4336b6 Mon Sep 17 00:00:00 2001 From: fanquake Date: Mon, 26 Jan 2026 12:26:59 +0000 Subject: [PATCH 5/5] doc: remove libevent --- doc/build-freebsd.md | 2 +- doc/build-netbsd.md | 2 +- doc/build-openbsd.md | 2 +- doc/build-osx.md | 2 +- doc/build-unix.md | 8 ++++---- doc/dependencies.md | 1 - src/wallet/rpc/encrypt.cpp | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/doc/build-freebsd.md b/doc/build-freebsd.md index 40740d7fb7b..11f53e08180 100644 --- a/doc/build-freebsd.md +++ b/doc/build-freebsd.md @@ -10,7 +10,7 @@ This guide describes how to build bitcoind, command-line utilities, and GUI on F Run the following as root to install the base dependencies for building. ```bash -pkg install boost-libs cmake git libevent pkgconf +pkg install boost-libs cmake git pkgconf ``` SQLite is required for the wallet: diff --git a/doc/build-netbsd.md b/doc/build-netbsd.md index f50baab4b20..b1b9e461187 100644 --- a/doc/build-netbsd.md +++ b/doc/build-netbsd.md @@ -12,7 +12,7 @@ Install the required dependencies the usual way you [install software on NetBSD] The example commands below use `pkgin`. ```bash -pkgin install git cmake pkg-config boost libevent +pkgin install git cmake pkg-config boost ``` NetBSD currently ships with an older version of `gcc` than is needed to build. You should upgrade your `gcc` and then pass this new version to the CMake configuration. diff --git a/doc/build-openbsd.md b/doc/build-openbsd.md index 5edc56f0bfc..d64fd909ddf 100644 --- a/doc/build-openbsd.md +++ b/doc/build-openbsd.md @@ -10,7 +10,7 @@ This guide describes how to build bitcoind, command-line utilities, and GUI on O Run the following as root to install the base dependencies for building. ```bash -pkg_add git cmake boost libevent +pkg_add git cmake boost ``` SQLite is required for the wallet: diff --git a/doc/build-osx.md b/doc/build-osx.md index a6a2d3befe8..f895ce88fb3 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -50,7 +50,7 @@ See [dependencies.md](dependencies.md) for a complete overview. To install, run the following from your terminal: ``` bash -brew install cmake boost pkgconf libevent capnp +brew install cmake boost pkgconf capnp ``` #### Wallet Dependencies diff --git a/doc/build-unix.md b/doc/build-unix.md index f1120d39e3f..e1d2364e23c 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -46,10 +46,10 @@ for additional features in later columns are optional. | Package manager | Required build dependencies | SQLite (wallet) | Cap'n Proto (IPC) | ZMQ | USDT | Qt and libqrencode (GUI) | | ----------------------- | --------------------------- | --------------- | ----------------- | --- | ---- | ------------------------ | -| Debian / Ubuntu (`apt`) | `build-essential cmake pkgconf python3 libevent-dev libboost-dev` | `libsqlite3-dev` | `libcapnp-dev capnproto` | `libzmq3-dev` | `systemtap-sdt-dev` | `qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libgl-dev qt6-wayland libqrencode-dev` | -| Fedora (`dnf`) | `gcc-c++ cmake make python3 libevent-devel boost-devel` | `sqlite-devel` | `capnproto capnproto-devel` | `zeromq-devel` | `systemtap-sdt-devel` | `qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland qrencode-devel` | -| Alpine (`apk`) | `build-base cmake linux-headers pkgconf python3 libevent-dev boost-dev` | `sqlite-dev` | `capnproto capnproto-dev` | `zeromq-dev` | Not supported | `qt6-qtbase-dev qt6-qttools-dev libqrencode-dev` | -| Arch (`pacman`) | `gcc make cmake pkgconf python libevent boost` | `sqlite` | `capnproto` | `zeromq` | `systemtap` | `qt6-base qt6-tools qt6-wayland qrencode` | +| Debian / Ubuntu (`apt`) | `build-essential cmake pkgconf python3 libboost-dev` | `libsqlite3-dev` | `libcapnp-dev capnproto` | `libzmq3-dev` | `systemtap-sdt-dev` | `qt6-base-dev qt6-tools-dev qt6-l10n-tools qt6-tools-dev-tools libgl-dev qt6-wayland libqrencode-dev` | +| Fedora (`dnf`) | `gcc-c++ cmake make python3 boost-devel` | `sqlite-devel` | `capnproto capnproto-devel` | `zeromq-devel` | `systemtap-sdt-devel` | `qt6-qtbase-devel qt6-qttools-devel qt6-qtwayland qrencode-devel` | +| Alpine (`apk`) | `build-base cmake linux-headers pkgconf python3 boost-dev` | `sqlite-dev` | `capnproto capnproto-dev` | `zeromq-dev` | Not supported | `qt6-qtbase-dev qt6-qttools-dev libqrencode-dev` | +| Arch (`pacman`) | `gcc make cmake pkgconf python boost` | `sqlite` | `capnproto` | `zeromq` | `systemtap` | `qt6-base qt6-tools qt6-wayland qrencode` | For Debian "oldstable", or earlier Ubuntu LTS releases, you may need to pick a later compiler version, according to the [dependencies](/doc/dependencies.md) diff --git a/doc/dependencies.md b/doc/dependencies.md index 5e1a19487e9..23e307844ac 100644 --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -23,7 +23,6 @@ Bitcoin Core requires one of the following compilers. | --- | --- | --- | | [Boost](../depends/packages/boost.mk) | [link](https://www.boost.org/users/download/) | [1.74.0](https://github.com/bitcoin/bitcoin/pull/34107) | | CMake | [link](https://cmake.org/) | [3.22](https://github.com/bitcoin/bitcoin/pull/30454) | -| [libevent](../depends/packages/libevent.mk) | [link](https://github.com/libevent/libevent/releases) | [2.1.8](https://github.com/bitcoin/bitcoin/pull/24681) | ### Runtime diff --git a/src/wallet/rpc/encrypt.cpp b/src/wallet/rpc/encrypt.cpp index 68a80eb80e1..49490d57b94 100644 --- a/src/wallet/rpc/encrypt.cpp +++ b/src/wallet/rpc/encrypt.cpp @@ -60,8 +60,8 @@ RPCMethod walletpassphrase() if (nSleepTime < 0) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Timeout cannot be negative."); } - // Clamp timeout - constexpr int64_t MAX_SLEEP_TIME = 100000000; // larger values trigger a macos/libevent bug? + // Clamp timeout to ~3 years to avoid overflow when computing the relock time + constexpr int64_t MAX_SLEEP_TIME = 100000000; if (nSleepTime > MAX_SLEEP_TIME) { nSleepTime = MAX_SLEEP_TIME; }