Skip to content

Commit a994210

Browse files
committed
Merge branch 'auxpow'
2 parents 677d06e + ec6c6f8 commit a994210

File tree

98 files changed

+3806
-1473
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+3806
-1473
lines changed

CMakePresets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"version": 3,
3-
"cmakeMinimumRequired": {"major": 3, "minor": 21, "patch": 0},
43
"configurePresets": [
54
{
65
"name": "vs2022",

ci/test/03_test_script.sh

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,22 @@ PRINT_CCACHE_STATISTICS="ccache --version | head -n 1 && ccache --show-stats"
115115

116116
# Folder where the build is done.
117117
BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-$HOST}
118-
mkdir -p "${BASE_BUILD_DIR}"
119-
cd "${BASE_BUILD_DIR}"
120118

121119
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_INSTALL_PREFIX=$BASE_OUTDIR -Werror=dev"
122120

123121
if [[ "${RUN_TIDY}" == "true" ]]; then
124122
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
125123
fi
126124

127-
bash -c "cmake -S $BASE_ROOT_DIR $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (cat $(cmake -P "${BASE_ROOT_DIR}/ci/test/GetCMakeLogFiles.cmake")) && false)"
125+
bash -c "cmake -S $BASE_ROOT_DIR -B ${BASE_BUILD_DIR} $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( (cat $(cmake -P "${BASE_ROOT_DIR}/ci/test/GetCMakeLogFiles.cmake")) && false)"
128126

129-
bash -c "cmake --build . $MAKEJOBS --target all $GOAL" || ( echo "Build failure. Verbose build follows." && cmake --build . --target all "$GOAL" --verbose ; false )
127+
# shellcheck disable=SC2086
128+
cmake --build "${BASE_BUILD_DIR}" "$MAKEJOBS" --target all $GOAL || (
129+
echo "Build failure. Verbose build follows."
130+
# shellcheck disable=SC2086
131+
cmake --build "${BASE_BUILD_DIR}" -j1 --target all $GOAL --verbose
132+
false
133+
)
130134

131135
bash -c "${PRINT_CCACHE_STATISTICS}"
132136
du -sh "${DEPENDS_DIR}"/*/
@@ -137,11 +141,17 @@ if [ -n "$USE_VALGRIND" ]; then
137141
fi
138142

139143
if [ "$RUN_CHECK_DEPS" = "true" ]; then
140-
"${BASE_ROOT_DIR}/contrib/devtools/check-deps.sh" .
144+
"${BASE_ROOT_DIR}/contrib/devtools/check-deps.sh" "${BASE_BUILD_DIR}"
141145
fi
142146

143147
if [ "$RUN_UNIT_TESTS" = "true" ]; then
144-
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" CTEST_OUTPUT_ON_FAILURE=ON ctest --stop-on-failure "${MAKEJOBS}" --timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
148+
DIR_UNIT_TEST_DATA="${DIR_UNIT_TEST_DATA}" \
149+
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
150+
CTEST_OUTPUT_ON_FAILURE=ON \
151+
ctest --test-dir "${BASE_BUILD_DIR}" \
152+
--stop-on-failure \
153+
"${MAKEJOBS}" \
154+
--timeout $(( TEST_RUNNER_TIMEOUT_FACTOR * 60 ))
145155
fi
146156

147157
if [ "$RUN_UNIT_TESTS_SEQUENTIAL" = "true" ]; then
@@ -151,7 +161,16 @@ fi
151161
if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
152162
# parses TEST_RUNNER_EXTRA as an array which allows for multiple arguments such as TEST_RUNNER_EXTRA='--exclude "rpc_bind.py --ipv6"'
153163
eval "TEST_RUNNER_EXTRA=($TEST_RUNNER_EXTRA)"
154-
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/functional/test_runner.py --ci "${MAKEJOBS}" --tmpdirprefix "${BASE_SCRATCH_DIR}"/test_runner/ --ansi --combinedlogslen=99999999 --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" "${TEST_RUNNER_EXTRA[@]}" --quiet --failfast
164+
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
165+
"${BASE_BUILD_DIR}/test/functional/test_runner.py" \
166+
--ci "${MAKEJOBS}" \
167+
--tmpdirprefix "${BASE_SCRATCH_DIR}/test_runner/" \
168+
--ansi \
169+
--combinedlogslen=99999999 \
170+
--timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" \
171+
"${TEST_RUNNER_EXTRA[@]}" \
172+
--quiet \
173+
--failfast
155174
fi
156175

157176
if [ "${RUN_TIDY}" = "true" ]; then
@@ -185,5 +204,11 @@ fi
185204

186205
if [ "$RUN_FUZZ_TESTS" = "true" ]; then
187206
# shellcheck disable=SC2086
188-
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" test/fuzz/test_runner.py ${FUZZ_TESTS_CONFIG} "${MAKEJOBS}" -l DEBUG "${DIR_FUZZ_IN}" --empty_min_time=60
207+
LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" \
208+
"${BASE_BUILD_DIR}/test/fuzz/test_runner.py" \
209+
${FUZZ_TESTS_CONFIG} \
210+
"${MAKEJOBS}" \
211+
-l DEBUG \
212+
"${DIR_FUZZ_IN}" \
213+
--empty_min_time=60
189214
fi

contrib/signet/miner

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def finish_block(block, signet_solution, grind_cmd):
9595
newheadhex = subprocess.run(cmd, stdout=subprocess.PIPE, input=b"", check=True).stdout.strip()
9696
newhead = from_hex(CBlockHeader(), newheadhex.decode('utf8'))
9797
block.nNonce = newhead.nNonce
98-
block.rehash()
9998
return block
10099

101100
def new_block(tmpl, reward_spk, *, blocktime=None, poolid=None):
@@ -482,15 +481,15 @@ def do_generate(args):
482481
# report
483482
bstr = "block" if gen.is_mine else "backup block"
484483

485-
next_delta = gen.next_block_delta(block.nBits, block.hash)
484+
next_delta = gen.next_block_delta(block.nBits, block.hash_hex)
486485
next_delta += block.nTime - time.time()
487-
next_is_mine = gen.next_block_is_mine(block.hash)
486+
next_is_mine = gen.next_block_is_mine(block.hash_hex)
488487

489-
logging.debug("Block hash %s payout to %s", block.hash, reward_addr)
488+
logging.debug("Block hash %s payout to %s", block.hash_hex, reward_addr)
490489
logging.info("Mined %s at height %d; next in %s (%s)", bstr, tmpl["height"], seconds_to_hms(next_delta), ("mine" if next_is_mine else "backup"))
491490
if r != "":
492-
logging.warning("submitblock returned %s for height %d hash %s", r, tmpl["height"], block.hash)
493-
lastheader = block.hash
491+
logging.warning("submitblock returned %s for height %d hash %s", r, tmpl["height"], block.hash_hex)
492+
lastheader = block.hash_hex
494493

495494
def do_calibrate(args):
496495
if args.nbits is not None and args.seconds is not None:

depends/funcs.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ $(1)_cmake=env CC="$$($(1)_cc)" \
224224
-DCMAKE_INSTALL_LIBDIR=lib/ \
225225
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
226226
-DCMAKE_VERBOSE_MAKEFILE:BOOL=$(V) \
227+
-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY:BOOL=TRUE \
227228
$$($(1)_config_opts)
228229
ifeq ($($(1)_type),build)
229230
$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"

depends/packages/libevent.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ $(package)_file_name=$(package)-$($(package)_version).tar.gz
55
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb
66
$(package)_patches=cmake_fixups.patch
77
$(package)_patches += netbsd_fixup.patch
8+
$(package)_patches += winver_fixup.patch
89
$(package)_build_subdir=build
910

1011
# When building for Windows, we set _WIN32_WINNT to target the same Windows
@@ -21,7 +22,8 @@ endef
2122

2223
define $(package)_preprocess_cmds
2324
patch -p1 < $($(package)_patch_dir)/cmake_fixups.patch && \
24-
patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch
25+
patch -p1 < $($(package)_patch_dir)/netbsd_fixup.patch && \
26+
patch -p1 < $($(package)_patch_dir)/winver_fixup.patch
2527
endef
2628

2729
define $(package)_config_cmds
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
Cherry-picked from a14ff91254f40cf36e0fee199e26fb11260fab49.
2+
3+
move _WIN32_WINNT defintions before first #include
4+
5+
_WIN32_WINNT and WIN32_LEAN_AND_MEAN need to be defined
6+
before the windows.h is included for the first time.
7+
Avoid the confusion of indirect #include by defining
8+
before any.
9+
10+
diff --git a/event_iocp.c b/event_iocp.c
11+
index 6b2a2e15..4955e426 100644
12+
--- a/event_iocp.c
13+
+++ b/event_iocp.c
14+
@@ -23,12 +23,14 @@
15+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
16+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17+
*/
18+
-#include "evconfig-private.h"
19+
20+
#ifndef _WIN32_WINNT
21+
/* Minimum required for InitializeCriticalSectionAndSpinCount */
22+
#define _WIN32_WINNT 0x0403
23+
#endif
24+
+
25+
+#include "evconfig-private.h"
26+
+
27+
#include <winsock2.h>
28+
#include <windows.h>
29+
#include <process.h>
30+
diff --git a/evthread_win32.c b/evthread_win32.c
31+
index 2ec80560..8647f72b 100644
32+
--- a/evthread_win32.c
33+
+++ b/evthread_win32.c
34+
@@ -23,18 +23,21 @@
35+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37+
*/
38+
-#include "event2/event-config.h"
39+
-#include "evconfig-private.h"
40+
41+
#ifdef _WIN32
42+
#ifndef _WIN32_WINNT
43+
/* Minimum required for InitializeCriticalSectionAndSpinCount */
44+
#define _WIN32_WINNT 0x0403
45+
#endif
46+
-#include <winsock2.h>
47+
#define WIN32_LEAN_AND_MEAN
48+
+#endif
49+
+
50+
+#include "event2/event-config.h"
51+
+#include "evconfig-private.h"
52+
+
53+
+#ifdef _WIN32
54+
+#include <winsock2.h>
55+
#include <windows.h>
56+
-#undef WIN32_LEAN_AND_MEAN
57+
#include <sys/locking.h>
58+
#endif
59+
60+
diff --git a/evutil.c b/evutil.c
61+
index 9817f086..8537ffe8 100644
62+
--- a/evutil.c
63+
+++ b/evutil.c
64+
@@ -24,6 +24,14 @@
65+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66+
*/
67+
68+
+#ifdef _WIN32
69+
+#ifndef _WIN32_WINNT
70+
+/* For structs needed by GetAdaptersAddresses */
71+
+#define _WIN32_WINNT 0x0501
72+
+#endif
73+
+#define WIN32_LEAN_AND_MEAN
74+
+#endif
75+
+
76+
#include "event2/event-config.h"
77+
#include "evconfig-private.h"
78+
79+
@@ -31,15 +39,10 @@
80+
#include <winsock2.h>
81+
#include <winerror.h>
82+
#include <ws2tcpip.h>
83+
-#define WIN32_LEAN_AND_MEAN
84+
#include <windows.h>
85+
-#undef WIN32_LEAN_AND_MEAN
86+
#include <io.h>
87+
#include <tchar.h>
88+
#include <process.h>
89+
-#undef _WIN32_WINNT
90+
-/* For structs needed by GetAdaptersAddresses */
91+
-#define _WIN32_WINNT 0x0501
92+
#include <iphlpapi.h>
93+
#include <netioapi.h>
94+
#endif
95+
diff --git a/listener.c b/listener.c
96+
index f5c00c9c..d1080e76 100644
97+
--- a/listener.c
98+
+++ b/listener.c
99+
@@ -24,16 +24,19 @@
100+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
101+
*/
102+
103+
+#ifdef _WIN32
104+
+#ifndef _WIN32_WINNT
105+
+/* Minimum required for InitializeCriticalSectionAndSpinCount */
106+
+#define _WIN32_WINNT 0x0403
107+
+#endif
108+
+#endif
109+
+
110+
#include "event2/event-config.h"
111+
#include "evconfig-private.h"
112+
113+
#include <sys/types.h>
114+
115+
#ifdef _WIN32
116+
-#ifndef _WIN32_WINNT
117+
-/* Minimum required for InitializeCriticalSectionAndSpinCount */
118+
-#define _WIN32_WINNT 0x0403
119+
-#endif
120+
#include <winsock2.h>
121+
#include <winerror.h>
122+
#include <ws2tcpip.h>

doc/tor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ outgoing connections, but more is possible.
5959
service provider.
6060
------------------------------------------------------------------------
6161

62-
If -proxy or -onion is specified multiple times, later occurences override
62+
If -proxy or -onion is specified multiple times, later occurrences override
6363
earlier ones and command line overrides the config file. UNIX domain sockets may
6464
be used for proxy connections. Set `-onion` or `-proxy` to the local socket path
6565
with the prefix `unix:` (e.g. `-onion=unix:/home/me/torsocket`).

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL
286286
node/timeoffsets.cpp
287287
node/transaction.cpp
288288
node/txdownloadman_impl.cpp
289+
node/txorphanage.cpp
289290
node/txreconciliation.cpp
290291
node/utxo_snapshot.cpp
291292
node/warnings.cpp
@@ -319,7 +320,6 @@ add_library(bitcoin_node STATIC EXCLUDE_FROM_ALL
319320
txdb.cpp
320321
txgraph.cpp
321322
txmempool.cpp
322-
txorphanage.cpp
323323
txrequest.cpp
324324
validation.cpp
325325
validationinterface.cpp

src/bench/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ add_executable(bench_namecoin
3535
mempool_eviction.cpp
3636
mempool_stress.cpp
3737
merkle_root.cpp
38+
obfuscation.cpp
3839
parse_hex.cpp
3940
peer_eviction.cpp
4041
poly1305.cpp
@@ -49,9 +50,9 @@ add_executable(bench_namecoin
4950
streams_findbyte.cpp
5051
strencodings.cpp
5152
txgraph.cpp
53+
txorphanage.cpp
5254
util_time.cpp
5355
verify_script.cpp
54-
xor.cpp
5556
)
5657

5758
include(TargetDataSources)

src/bench/xor.cpp renamed to src/bench/obfuscation.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@
44

55
#include <bench/bench.h>
66
#include <random.h>
7-
#include <span.h>
8-
#include <streams.h>
7+
#include <util/obfuscation.h>
98

109
#include <cstddef>
1110
#include <vector>
1211

13-
static void Xor(benchmark::Bench& bench)
12+
static void ObfuscationBench(benchmark::Bench& bench)
1413
{
1514
FastRandomContext frc{/*fDeterministic=*/true};
1615
auto data{frc.randbytes<std::byte>(1024)};
17-
auto key{frc.randbytes<std::byte>(31)};
16+
const Obfuscation obfuscation{frc.randbytes<Obfuscation::KEY_SIZE>()};
1817

18+
size_t offset{0};
1919
bench.batch(data.size()).unit("byte").run([&] {
20-
util::Xor(data, key);
20+
obfuscation(data, offset++); // mutated differently each time
21+
ankerl::nanobench::doNotOptimizeAway(data);
2122
});
2223
}
2324

24-
BENCHMARK(Xor, benchmark::PriorityLevel::HIGH);
25+
BENCHMARK(ObfuscationBench, benchmark::PriorityLevel::HIGH);

0 commit comments

Comments
 (0)