From 8a997b04f33bb3383d5af0cc3a8bcafe90bbe319 Mon Sep 17 00:00:00 2001 From: Duke Date: Sun, 9 Jun 2024 11:22:21 -0400 Subject: [PATCH 1/5] Check if the node should stop when processing thread interrupts and exceptions, in hopes of stopping before a deadlock occurs --- src/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.h b/src/util.h index eeef26f86..ccc3f0486 100644 --- a/src/util.h +++ b/src/util.h @@ -47,6 +47,8 @@ static const bool DEFAULT_LOGTIMEMICROS = false; static const bool DEFAULT_LOGIPS = false; static const bool DEFAULT_LOGTIMESTAMPS = true; +void CheckIfWeShouldStop(); + /** Signals for translation. */ class CTranslationInterface { @@ -272,14 +274,17 @@ template void TraceThread(const char* name, Callable func) catch (const boost::thread_interrupted&) { LogPrintf("%s thread interrupt\n", name); + CheckIfWeShouldStop(); throw; } catch (const std::exception& e) { PrintExceptionContinue(&e, name); + CheckIfWeShouldStop(); throw; } catch (...) { PrintExceptionContinue(NULL, name); + CheckIfWeShouldStop(); throw; } } From 8d2380a31d9a6e150ee3be56149d1d262fccaf18 Mon Sep 17 00:00:00 2001 From: Duke Date: Sun, 9 Jun 2024 12:10:59 -0400 Subject: [PATCH 2/5] Record value of DEBUG_LOCKORDER in debug.log --- src/init.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index 91aeda565..7458d4847 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1085,6 +1085,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); LogPrintf("Hush version %s (%s)\n", FormatFullVersion()); + +#ifdef DEBUG_LOCKORDER + LogPrintf("DEBUG_LOCKORDER enabled\n"); +#else + LogPrintf("DEBUG_LOCKORDER disabled\n"); +#endif + // when specifying an explicit binding address, you want to listen on it // even when -connect or -proxy is specified if (mapArgs.count("-bind")) { From 379e419aad3edfa7eee2e41a48934e4220a52e61 Mon Sep 17 00:00:00 2001 From: Duke Date: Wed, 12 Jun 2024 13:12:20 -0400 Subject: [PATCH 3/5] Convenience script for doing a debug build while autodecting correct OS build script --- debug-build.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 debug-build.sh diff --git a/debug-build.sh b/debug-build.sh new file mode 100755 index 000000000..a18818b20 --- /dev/null +++ b/debug-build.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Copyright (c) 2016-2024 The Hush developers +# Distributed under the GPLv3 software license, see the accompanying +# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html + +set -eu -o pipefail + +echo "Compiling a debug build with --enable-debug..." + +# run correct build script for detected OS +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + CONFIGURE_FLAGS=--enable-debug ./util/build.sh --disable-tests $@ +elif [[ "$OSTYPE" == "darwin"* ]]; then + # code from ./util/build.sh needs to be ported to support --disable-tests + #./util/build-mac.sh --disable-tests $@ + CONFIGURE_FLAGS=--enable-debug ./util/build-mac.sh $@ +elif [[ "$OSTYPE" == "msys"* ]]; then + CONFIGURE_FLAGS=--enable-debug ./util/build-win.sh --disable-tests $@ +elif [[ "$OSTYPE" == "freebsd"* ]]; then + CONFIGURE_FLAGS=--enable-debug ./util/build.sh --disable-tests $@ +else + echo "Unable to detect your OS. What are you using?" +fi From 7f274892241c63ebdea4569410e00e2843a13570 Mon Sep 17 00:00:00 2001 From: Duke Date: Wed, 7 Aug 2024 07:11:13 -0700 Subject: [PATCH 4/5] Speed up compile by disabling libevent sample code, originally https://github.com/bitcoin/bitcoin/commit/f38c05104848db63ad0df85c24eea466dbff8536 --- depends/packages/libevent.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index b3881738a..8b01061fc 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -13,7 +13,7 @@ define $(package)_preprocess_cmds endef define $(package)_set_vars - $(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress + $(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples $(package)_config_opts_release=--disable-debug-mode $(package)_config_opts_linux=--with-pic endef From 1e892f23e6c33984225ee6006ba5391eef73fc90 Mon Sep 17 00:00:00 2001 From: Duke Date: Wed, 7 Aug 2024 07:18:08 -0700 Subject: [PATCH 5/5] Remove dead nVersion code This is very old code from the early days of Bitcoin, our mainnets have never used peer protocol version. Originally https://github.com/zcash/zcash/commit/150ab1d34c98096d28d4f7951a02516232f40ae2 --- src/main.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 475c1546b..ae5e27916 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6915,8 +6915,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, int nVersion; // use temporary for version, don't set version number until validated as connected const int minVersion = ishush3 ? MIN_HUSH_PEER_PROTO_VERSION : MIN_PEER_PROTO_VERSION; vRecv >> nVersion >> pfrom->nServices >> nTime >> addrMe; - if (nVersion == 10300) - nVersion = 300; + if (nVersion < minVersion) { // disconnect from peers older than this proto version