coins: introduce thread pool in CoinsViewOverlay

Introduce a ThreadPool shared pointer to CoinsViewOverlay. A pool managed
externally can be passed in the constructor.

A global thread pool is used in fuzz harnesses since iterations can happen
faster than the OS can create and tear down thread pools.
This can cause a memory leak when fuzzing.

Co-authored-by: l0rinc <pap.lorinc@gmail.com>
This commit is contained in:
Andrew Toth
2026-03-07 19:29:20 -05:00
parent 5bf1c32008
commit f82043af50
10 changed files with 75 additions and 15 deletions

View File

@@ -566,6 +566,8 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
# nMaxConnections = available_fds - min_required_fds = 256 - 161 = 94;
f.write("maxconnections=94\n")
f.write("par=" + str(min(2, os.cpu_count())) + "\n")
# Use a single prevoutfetch worker thread to keep per-node resource usage low.
f.write("prevoutfetchthreads=1\n")
f.write(extra_config)