util: zero-pad thread number suffixes
What changed, and why it matters
This commit simply changes how some internal Bitcoin Core worker threads are named. Instead of thread names like 'scriptch.1' or 'http.9', they now appear as 'scriptch.01' or 'http.09' with a leading zero. This makes lists of threads easier to read and sort. It does not change any security behavior, fix a bug, or introduce a vulnerability.
No security action needed. This is a readability/documentation-style change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch zero-pads integer suffixes in thread names from %i/%d to %02i/%02d in CCheckQueue worker threads (scriptch.xx) and util::ThreadPool workers (e.g., http.xx). The change is purely cosmetic: it affects only the string passed to util::ThreadRename/util::TraceThread. No logic, concurrency, memory handling, or trust boundary is altered.
Changed components
src/checkqueue.hsrc/util/threadpool.hdoc/developer-notes.mdInspect captured patch +4 / −4
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index c7ec0ca4..129fdda7 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -699,13 +699,13 @@ and its `cs_KeyStore` lock for example).
: Performs various loading tasks that are part of init but shouldn't block the node from being started: external block import,
reindex, reindex-chainstate, main chain activation, spawn indexes background sync threads and mempool load.
-- [CCheckQueue::Loop (`b-scriptch.x`)](https://doxygen.bitcoincore.org/class_c_check_queue.html#checkqueue)
+- [CCheckQueue::Loop (`b-scriptch.xx`)](https://doxygen.bitcoincore.org/class_c_check_queue.html#checkqueue)
: Parallel script validation threads for transactions in blocks.
- [ThreadHTTP (`b-http`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#http)
: Libevent thread to listen for RPC and REST connections.
-- [HTTP worker threads (`b-http.x`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#http_pool)
+- [HTTP worker threads (`b-http.xx`)](https://doxygen.bitcoincore.org/httpserver_8cpp.html#http_pool)
: Threads to service RPC and REST requests.
- [Indexer threads (`b-txindex`, etc)](https://doxygen.bitcoincore.org/class_base_index.html#index_sync)
diff --git a/src/checkqueue.h b/src/checkqueue.h
index 1e265525..7d107a18 100644
--- a/src/checkqueue.h
+++ b/src/checkqueue.h
@@ -149,7 +149,7 @@ public:
m_worker_threads.reserve(worker_threads_num);
for (int n = 0; n < worker_threads_num; ++n) {
m_worker_threads.emplace_back([this, n]() {
- util::ThreadRename(strprintf("scriptch.%i", n));
+ util::ThreadRename(strprintf("scriptch.%02i", n));
Loop(false /* worker thread */);
});
}
diff --git a/src/util/threadpool.h b/src/util/threadpool.h
index 6e35df27..6c168515 100644
--- a/src/util/threadpool.h
+++ b/src/util/threadpool.h
@@ -112,7 +112,7 @@ public:
// Create workers
m_workers.reserve(num_workers);
for (int i = 0; i < num_workers; i++) {
- m_workers.emplace_back(&util::TraceThread, strprintf("%s.%d", m_name, i), [this] { WorkerThread(); });
+ m_workers.emplace_back(&util::TraceThread, strprintf("%s.%02d", m_name, i), [this] { WorkerThread(); });
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.