elements/src/common
fanquake dd73c22976
Merge bitcoin/bitcoin#28486: test, bench: Initialize and terminate use of Winsock properly
fd4c6a10f2 test: Setup networking globally (Hennadii Stepanov)

Pull request description:

  On the master branch, when compiling without external signer support, the `bench_bitcoin.exe` does not initialize Winsock DLL that is required, for example, here: 459272d639/src/bench/addrman.cpp (L124)

  Moreover, Windows docs explicitly [state](https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsacleanup) that `WSAStartup` and `WSACleanup` must be balanced:
  > There must be a call to `WSACleanup` for each successful call to `WSAStartup`. Only the final `WSACleanup` function call performs the actual cleanup. The preceding calls simply decrement an internal reference count in the WS2_32.DLL.

  That is not the case for our unit tests because the `SetupNetworking()` call is a part of the `BasicTestingSetup` fixture and is invoked multiple times, while `~CNetCleanup()` is invoked once only, at the end of the test binary execution.

  This PR fixes Winsock DLL initialization and termination.

  More docs:
  - https://learn.microsoft.com/en-us/windows/win32/winsock/initializing-winsock
  - https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup
  - https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsacleanup

  Fix https://github.com/bitcoin/bitcoin/issues/28940.

ACKs for top commit:
  maflcko:
    lgtm ACK fd4c6a10f2

Tree-SHA512: d360eaf776943f7f7a35ed5a5f9f3228d9e3d18eb824e5997cdc8eadddf466abe9f2da4910ee3bb86bf5411061e758259f7e1ec344f234ef7996f1bf8781dcda
2023-11-29 17:14:34 +00:00
..
args.cpp Merge bitcoin/bitcoin#28076: util: Replace std::filesystem with util/fs.h 2023-11-13 14:10:54 +00:00
args.h util: Add ArgsManager SetConfigFilePath method 2023-10-20 10:30:16 -04:00
bloom.cpp Use Txid in COutpoint 2023-11-21 13:15:44 +00:00
bloom.h scripted-diff: Bump copyright headers 2021-12-30 19:36:57 +02:00
config.cpp scripted-diff: move settings to common namespace 2023-05-30 17:26:51 +02:00
init.cpp Merge bitcoin/bitcoin#27302: init: Error if ignored bitcoin.conf file is found 2023-05-26 13:33:42 +01:00
init.h Deduplicate bitcoind and bitcoin-qt init code 2023-02-28 12:04:47 -05:00
interfaces.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
run_command.cpp refactor: remove in-code warning suppression 2023-06-29 14:41:33 +01:00
run_command.h refactor: move run_command from util to common 2022-10-04 21:21:05 +00:00
settings.cpp scripted-diff: Following the C++ Standard rules for identifiers with _. 2023-06-20 10:23:08 +02:00
settings.h scripted-diff: move settings to common namespace 2023-05-30 17:26:51 +02:00
system.cpp Move compat.h include from system.h to system.cpp 2023-10-16 14:34:30 +02:00
system.h Merge bitcoin/bitcoin#28486: test, bench: Initialize and terminate use of Winsock properly 2023-11-29 17:14:34 +00:00
url.cpp scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00
url.h scripted-diff: Bump copyright headers 2022-12-24 23:49:50 +00:00