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

@@ -135,6 +135,9 @@ class ProxyTest(BitcoinTestFramework):
if self.have_unix_sockets:
args[5] = ['-listen', f'-proxy=unix:{socket_path}']
args[6] = ['-listen', f'-onion=unix:{socket_path}']
# This test launches many nodes; disable prevout prefetching so we don't spin up a
# thread pool for each one.
args = [a + ['-prevoutfetchthreads=0'] for a in args]
self.add_nodes(self.num_nodes, extra_args=args)
self.start_nodes()