Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Nov 17, 2024
2 parents 561a3f9 + ccc2d3a commit b658ba9
Show file tree
Hide file tree
Showing 75 changed files with 1,646 additions and 293 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ jobs:
asan-lsan-ubsan-integer-no-depends-usdt:
name: 'ASan + LSan + UBSan + integer, no depends, USDT'
runs-on: ubuntu-24.04 # has to match container in ci/test/00_setup_env_native_asan.sh for tracing tools
# No need to run on the read-only mirror, unless it is a PR.
# if: github.event_name == 'pull_request'
timeout-minutes: 120
env:
FILE_ENV: "./ci/test/00_setup_env_native_asan.sh"
Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_i686_centos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export LC_ALL=C.UTF-8
export HOST=i686-pc-linux-gnu
export CONTAINER_NAME=ci_i686_centos
export CI_IMAGE_NAME_TAG="quay.io/centos/amd64:stream9"
export CI_BASE_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache make git python3 python3-pip which patch lbzip2 xz procps-ng dash rsync coreutils bison util-linux e2fsprogs cmake"
export CI_BASE_PACKAGES="gcc-c++ glibc-devel.x86_64 libstdc++-devel.x86_64 glibc-devel.i686 libstdc++-devel.i686 ccache make git python3 python3-pip which patch lbzip2 xz procps-ng dash rsync coreutils bison e2fsprogs cmake"
export PIP_PACKAGES="pyzmq"
export GOAL="install"
export NO_WERROR=1 # Suppress error: #warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform [-Werror=cpp]
Expand Down
3 changes: 0 additions & 3 deletions cmake/bitcoin-build-config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
*/
#cmakedefine01 HAVE_DECL_SETSID

/* Define this symbol if evhttp_connection_get_peer expects const char** */
#cmakedefine HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR 1

/* Define to 1 if fdatasync is available. */
#cmakedefine HAVE_FDATASYNC 1

Expand Down
60 changes: 33 additions & 27 deletions cmake/module/FindLibevent.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,52 @@ function(check_evhttp_connection_get_peer target)
" HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
)
cmake_pop_check_state()
set(HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR ${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR} PARENT_SCOPE)
target_compile_definitions(${target} INTERFACE
$<$<BOOL:${HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR}>: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(VCPKG_TARGET_TRIPLET)
find_package(Libevent ${Libevent_FIND_VERSION} NO_MODULE QUIET
COMPONENTS extra
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)
add_library(libevent::libevent ALIAS libevent::extra)
mark_as_advanced(Libevent_DIR)
mark_as_advanced(_event_h)
mark_as_advanced(_event_lib)
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(libevent QUIET
IMPORTED_TARGET
libevent>=${Libevent_FIND_VERSION}
)
set(_libevent_required_vars libevent_LIBRARY_DIRS libevent_FOUND)
if(NOT WIN32)
pkg_check_modules(libevent_pthreads QUIET
IMPORTED_TARGET
libevent_pthreads>=${Libevent_FIND_VERSION}
foreach(component IN LISTS _libevent_components)
pkg_check_modules(libevent_${component}
REQUIRED QUIET
IMPORTED_TARGET GLOBAL
libevent_${component}>=${Libevent_FIND_VERSION}
)
list(APPEND _libevent_required_vars libevent_pthreads_FOUND)
endif()
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_required_vars}
VERSION_VAR libevent_VERSION
REQUIRED_VARS libevent_core_LIBRARY_DIRS
VERSION_VAR libevent_core_VERSION
)
unset(_libevent_required_vars)
check_evhttp_connection_get_peer(PkgConfig::libevent)
add_library(libevent::libevent ALIAS PkgConfig::libevent)
if(NOT WIN32)
add_library(libevent::pthreads ALIAS PkgConfig::libevent_pthreads)
endif()
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)
3 changes: 1 addition & 2 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(gnu packages gawk)
(gnu packages gcc)
((gnu packages installers) #:select (nsis-x86_64))
((gnu packages linux) #:select (linux-libre-headers-6.1 util-linux))
((gnu packages linux) #:select (linux-libre-headers-6.1))
(gnu packages llvm)
(gnu packages mingw)
(gnu packages moreutils)
Expand Down Expand Up @@ -493,7 +493,6 @@ inspecting signatures in Mach-O binaries.")
bash-minimal
which
coreutils-minimal
util-linux
;; File(system) inspection
file
grep
Expand Down
9 changes: 4 additions & 5 deletions depends/packages/libevent.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ $(package)_download_path=https://github.com/libevent/libevent/releases/download/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
$(package)_patches=cmake_fixups.patch
$(package)_patches+=fix_mingw_link.patch
$(package)_build_subdir=build

# When building for Windows, we set _WIN32_WINNT to target the same Windows
Expand All @@ -23,8 +22,7 @@ define $(package)_set_vars
endef

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \
patch -p1 < $($(package)_patch_dir)/fix_mingw_link.patch
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch
endef

define $(package)_config_cmds
Expand All @@ -40,7 +38,8 @@ define $(package)_stage_cmds
endef

define $(package)_postprocess_cmds
rm -rf bin && \
rm -rf bin lib/pkgconfig && \
rm include/ev*.h && \
rm include/event2/*_compat.h
rm include/event2/*_compat.h && \
rm lib/libevent.a
endef
22 changes: 0 additions & 22 deletions depends/patches/libevent/cmake_fixups.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
cmake: set minimum version to 3.5

Fix generated pkg-config files, see
https://github.com/libevent/libevent/pull/1165.

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@
Expand All @@ -14,22 +11,3 @@ https://github.com/libevent/libevent/pull/1165.

if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
diff --git a/cmake/AddEventLibrary.cmake b/cmake/AddEventLibrary.cmake
index 04f5837e..d8ea42c4 100644
--- a/cmake/AddEventLibrary.cmake
+++ b/cmake/AddEventLibrary.cmake
@@ -20,12 +20,12 @@ macro(generate_pkgconfig LIB_NAME)

set(LIBS "")
foreach (LIB ${LIB_PLATFORM})
- set(LIBS "${LIBS} -L${LIB}")
+ set(LIBS "${LIBS} -l${LIB}")
endforeach()

set(OPENSSL_LIBS "")
foreach(LIB ${OPENSSL_LIBRARIES})
- set(OPENSSL_LIBS "${OPENSSL_LIBS} -L${LIB}")
+ set(OPENSSL_LIBS "${OPENSSL_LIBS} -l${LIB}")
endforeach()

configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY)
25 changes: 0 additions & 25 deletions depends/patches/libevent/fix_mingw_link.patch

This file was deleted.

2 changes: 1 addition & 1 deletion doc/build-unix.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Setup and Build Example: 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 --sync --needed cmake boost gcc git libevent make pkgconf python sqlite
pacman --sync --needed cmake boost gcc git libevent make python sqlite
git clone https://github.com/groestlcoin/groestlcoin.git
cd groestlcoin/
cmake -B build
Expand Down
2 changes: 1 addition & 1 deletion doc/multisig-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ multisig_desc="[$multisig_ext_desc, $multisig_int_desc]"

`external_desc` and `internal_desc` specify the output type (`wsh`, in this case) and the xpubs involved. They also use BIP 67 (`sortedmulti`), so the wallet can be recreated without worrying about the order of xpubs. Conceptually, descriptors describe a list of scriptPubKey (along with information for spending from it) [[source](https://github.com/bitcoin/bitcoin/issues/21199#issuecomment-780772418)].

Note that at least two descriptors are usually used, one for internal derivation paths and external ones. There are discussions about eliminating this redundancy, as can been seen in the issue [#17190](https://github.com/bitcoin/bitcoin/issues/17190).
Note that at least two descriptors are usually used, one for internal derivation paths and one for external ones. There are discussions about eliminating this redundancy, as can be seen in the issue [#17190](https://github.com/bitcoin/bitcoin/issues/17190).

After creating the descriptors, it is necessary to add the checksum, which is required by the `importdescriptors` RPC.

Expand Down
3 changes: 2 additions & 1 deletion doc/offline-signing-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ The `watch_only_wallet` wallet will be used to track and validate incoming trans
```sh
[online]$ ./build/src/groestlcoin-cli -signet -named createwallet \
wallet_name="watch_only_wallet" \
disable_private_keys=true
disable_private_keys=true \
blank=true

{
"name": "watch_only_wallet"
Expand Down
4 changes: 4 additions & 0 deletions doc/psbt.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ hardware implementations will typically implement multiple roles simultaneously.
input a PSBT, adds UTXO, key, and script data to inputs and outputs that miss
it, and optionally signs inputs. Where possible it also finalizes the partial
signatures.
- **`descriptorprocesspsbt` (Updater, Signer, Finalizer)** is a node RPC that takes
as input a PSBT and a list of descriptors. It updates SegWit inputs with
information available from the UTXO set and the mempool and signs the inputs using
the provided descriptors. Where possible it also finalizes the partial signatures.
- **`utxoupdatepsbt` (Updater)** is a node RPC that takes a PSBT and updates it
to include information available from the UTXO set (works only for SegWit
inputs).
Expand Down
12 changes: 12 additions & 0 deletions doc/release-notes-30239.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
P2P and network changes
-----------------------

Ephemeral dust is a new concept that allows a single
dust output in a transaction, provided the transaction
is zero fee. In order to spend any unconfirmed outputs
from this transaction, the spender must also spend
this dust in addition to any other outputs.

In other words, this type of transaction
should be created in a transaction package where
the dust is both created and spent simultaneously.
9 changes: 6 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL
node/utxo_snapshot.cpp
node/warnings.cpp
noui.cpp
policy/ephemeral_policy.cpp
policy/fees.cpp
policy/fees_args.cpp
policy/packages.cpp
Expand Down Expand Up @@ -299,13 +300,14 @@ target_link_libraries(bitcoin_node
core_interface
bitcoin_common
bitcoin_util
$<TARGET_NAME_IF_EXISTS:bitcoin_zmq>
leveldb
minisketch
univalue
Boost::headers
$<TARGET_NAME_IF_EXISTS:libevent::libevent>
libevent::core
libevent::extra
$<TARGET_NAME_IF_EXISTS:libevent::pthreads>
$<TARGET_NAME_IF_EXISTS:bitcoin_zmq>
$<TARGET_NAME_IF_EXISTS:USDT::headers>
)

Expand Down Expand Up @@ -375,7 +377,8 @@ if(BUILD_CLI)
bitcoin_cli
bitcoin_common
bitcoin_util
$<TARGET_NAME_IF_EXISTS:libevent::libevent>
libevent::core
libevent::extra
)
list(APPEND installable_targets groestlcoin-cli)
endif()
Expand Down
2 changes: 2 additions & 0 deletions src/addrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,11 @@ nid_type AddrManImpl::GetEntry(bool use_tried, size_t bucket, size_t position) c
std::vector<CAddress> AddrManImpl::GetAddr_(size_t max_addresses, size_t max_pct, std::optional<Network> network, const bool filtered) const
{
AssertLockHeld(cs);
Assume(max_pct <= 100);

size_t nNodes = vRandom.size();
if (max_pct != 0) {
max_pct = std::min(max_pct, size_t{100});
nNodes = max_pct * nNodes / 100;
}
if (max_addresses != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/addrman.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class AddrMan
* Return all or many randomly selected addresses, optionally by network.
*
* @param[in] max_addresses Maximum number of addresses to return (0 = all).
* @param[in] max_pct Maximum percentage of addresses to return (0 = all).
* @param[in] max_pct Maximum percentage of addresses to return (0 = all). Value must be from 0 to 100.
* @param[in] network Select only addresses of this network (nullopt = all).
* @param[in] filtered Select only addresses that are considered good quality (false = all).
*
Expand Down
1 change: 1 addition & 0 deletions src/bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ add_executable(bench_bitcoin
load_external.cpp
lockedpool.cpp
logging.cpp
mempool_ephemeral_spends.cpp
mempool_eviction.cpp
mempool_stress.cpp
merkle_root.cpp
Expand Down
30 changes: 28 additions & 2 deletions src/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,26 @@ using util::Join;

const std::function<void(const std::string&)> G_TEST_LOG_FUN{};

const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS{};
/**
* Retrieves the available test setup command line arguments that may be used
* in the benchmark. They will be used only if the benchmark utilizes a
* 'BasicTestingSetup' or any child of it.
*/
static std::function<std::vector<const char*>()> g_bench_command_line_args{};
const std::function<std::vector<const char*>()> G_TEST_COMMAND_LINE_ARGUMENTS = []() {
return g_bench_command_line_args();
};

const std::function<std::string()> G_TEST_GET_FULL_NAME{};
/**
* Retrieve the name of the currently in-use benchmark.
* This is applicable only to benchmarks that utilize the unit test
* framework context setup (e.g. ones using 'MakeNoLogFileContext<TestingSetup>()').
* It places the datadir of each benchmark run within their respective benchmark name.
*/
static std::string g_running_benchmark_name;
const std::function<std::string()> G_TEST_GET_FULL_NAME = []() {
return g_running_benchmark_name;
};

namespace {

Expand Down Expand Up @@ -94,6 +111,14 @@ void BenchRunner::RunAll(const Args& args)
std::cout << "Running with -sanity-check option, output is being suppressed as benchmark results will be useless." << std::endl;
}

// Load inner test setup args
g_bench_command_line_args = [&args]() {
std::vector<const char*> ret;
ret.reserve(args.setup_args.size());
for (const auto& arg : args.setup_args) ret.emplace_back(arg.c_str());
return ret;
};

std::vector<ankerl::nanobench::Result> benchmarkResults;
for (const auto& [name, bench_func] : benchmarks()) {
const auto& [func, priority_level] = bench_func;
Expand All @@ -117,6 +142,7 @@ void BenchRunner::RunAll(const Args& args)
bench.output(nullptr);
}
bench.name(name);
g_running_benchmark_name = name;
if (args.min_time > 0ms) {
// convert to nanos before dividing to reduce rounding errors
std::chrono::nanoseconds min_time_ns = args.min_time;
Expand Down
1 change: 1 addition & 0 deletions src/bench/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct Args {
fs::path output_json;
std::string regex_filter;
uint8_t priority;
std::vector<std::string> setup_args;
};

class BenchRunner
Expand Down
Loading

0 comments on commit b658ba9

Please sign in to comment.