refactor: remove more dead code #36820

Open
fanquake wants to merge 25 commits from some_more_removals into master AGit
fanquake commented 2026-11-09 18:41:02 +00:00 (Migrated from github.com)

Similar to #36509. Also generally related to #36167.

Similar to #36509. Also generally related to #36167.
DrahtBot commented 2026-11-09 18:41:13 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK stickies-v

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36904 (log: Remove trailing and embedded newlines from log messages by maflcko)
  • #36897 (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
  • #36768 (kernel: Dispatch log callbacks with btcsignals by ryanofsky)
  • #36525 (mining: add Block interface, fix template data race by Sjors)
  • #36372 (p2p: replace full outbound peers that don't support tx relay (take 2) by fjahr)
  • #36268 (refactor: prune unused semi-colons by fanquake)
  • #36167 (build: Enable -Wunused by fanquake)
  • #36122 (BIP460: CISA for Taproot key path spends by fjahr)
  • #35911 (Warn on and add missing [[noreturn]] by fanquake)
  • #34775 (kernel: allow only one global logging connection by stickies-v)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36820 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36820.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36820#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [stickies-v](https://github.com/bitcoin/bitcoin/pull/36820#pullrequestreview-6150387085) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#36904](https://github.com/bitcoin/bitcoin/pull/36904) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36904.svg"></sub> (log: Remove trailing and embedded newlines from log messages by maflcko) * [#36897](https://github.com/bitcoin/bitcoin/pull/36897) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36897.svg"></sub> (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101) * [#36768](https://github.com/bitcoin/bitcoin/pull/36768) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36768.svg"></sub> (kernel: Dispatch log callbacks with btcsignals by ryanofsky) * [#36525](https://github.com/bitcoin/bitcoin/pull/36525) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36525.svg"></sub> (mining: add Block interface, fix template data race by Sjors) * [#36372](https://github.com/bitcoin/bitcoin/pull/36372) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36372.svg"></sub> (p2p: replace full outbound peers that don't support tx relay (take 2) by fjahr) * [#36268](https://github.com/bitcoin/bitcoin/pull/36268) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36268.svg"></sub> (refactor: prune unused semi-colons by fanquake) * [#36167](https://github.com/bitcoin/bitcoin/pull/36167) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36167.svg"></sub> (build: Enable `-Wunused` by fanquake) * [#36122](https://github.com/bitcoin/bitcoin/pull/36122) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36122.svg"></sub> (BIP460: CISA for Taproot key path spends by fjahr) * [#35911](https://github.com/bitcoin/bitcoin/pull/35911) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35911.svg"></sub> (Warn on and add missing `[[noreturn]]` by fanquake) * [#34775](https://github.com/bitcoin/bitcoin/pull/34775) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34775.svg"></sub> (kernel: allow only one global logging connection by stickies-v) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

No findings were published from this review.

Review coverage was incomplete.


Reviewed: 1fdc12210471 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:e1a29e5e677c47d383756f0fcf8f3760725c91d1104dd3ccb2f333b6217eba26:47880f5569fd2047d249266f337c4f2a509adf7d96c3ccb1c7644c2c2a650bff --> <!-- ralph-base:cc27c50e87f348c154512a15f53cd552d4cd8844 --> <!-- ralph-head:1fdc122104714fb3c1a32ed47bc3ef6238239bea --> <!-- ralph-case:389c4210080ba1ce6e2440c7d44212c08a7aa228ab53c2195a39301fa9bf1ae0 --> No findings were published from this review. Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`1fdc12210471`](<https://git.fish.foo/bitcoin/bitcoin/commit/1fdc122104714fb3c1a32ed47bc3ef6238239bea>) · [Review report](<https://review.fish.foo/report/36820-1fdc122104714fb3c1a32ed47bc3ef6238239bea-3432-2.html>) · [Previous reports](<https://review.fish.foo/traces/36820/>) [permalink](<https://review.fish.foo/report/36820-1fdc122104714fb3c1a32ed47bc3ef6238239bea-3432-2.html>)
stickies-v (Migrated from github.com) approved these changes 2026-12-01 16:48:50 +00:00
stickies-v (Migrated from github.com) left a comment
ACK 5935ae60a85871213a4915d94d9c8c9777a7391b
stickies-v (Migrated from github.com) commented 2026-12-01 16:22:53 +00:00

nit: could remove trailing newlines and unused strCaption while touching this:

git diff on 5935ae60a8
diff --git a/src/noui.cpp b/src/noui.cpp
index 55f88c0b33..56e4251aec 100644
--- a/src/noui.cpp
+++ b/src/noui.cpp
@@ -23,18 +23,18 @@ void noui_ThreadSafeMessageBox(const bilingual_str& message, unsigned int style)
     switch (style) {
     case CClientUIInterface::MSG_ERROR:
         strCaption = "Error: ";
-        LogError("%s\n", message.original);
+        LogError("%s", message.original);
         break;
     case CClientUIInterface::MSG_WARNING:
         strCaption = "Warning: ";
-        LogWarning("%s\n", message.original);
+        LogWarning("%s", message.original);
         break;
     case CClientUIInterface::MSG_INFORMATION:
         strCaption = "Information: ";
-        LogInfo("%s\n", message.original);
+        LogInfo("%s", message.original);
         break;
     default:
-        LogInfo("%s%s\n", strCaption, message.original);
+        LogInfo("%s", message.original);
     }
 
     tfm::format(std::cerr, "%s%s\n", strCaption, message.original);

nit: could remove trailing newlines and unused `strCaption` while touching this: <details> <summary>git diff on 5935ae60a8</summary> ```diff diff --git a/src/noui.cpp b/src/noui.cpp index 55f88c0b33..56e4251aec 100644 --- a/src/noui.cpp +++ b/src/noui.cpp @@ -23,18 +23,18 @@ void noui_ThreadSafeMessageBox(const bilingual_str& message, unsigned int style) switch (style) { case CClientUIInterface::MSG_ERROR: strCaption = "Error: "; - LogError("%s\n", message.original); + LogError("%s", message.original); break; case CClientUIInterface::MSG_WARNING: strCaption = "Warning: "; - LogWarning("%s\n", message.original); + LogWarning("%s", message.original); break; case CClientUIInterface::MSG_INFORMATION: strCaption = "Information: "; - LogInfo("%s\n", message.original); + LogInfo("%s", message.original); break; default: - LogInfo("%s%s\n", strCaption, message.original); + LogInfo("%s", message.original); } tfm::format(std::cerr, "%s%s\n", strCaption, message.original); ``` </details>
stickies-v (Migrated from github.com) commented 2026-12-01 15:13:23 +00:00

The ctx parameter in InferMultiA is now dead code too:

git diff on 5935ae60a8
diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp
index fc9f17f94c..758a1070b3 100644
--- a/src/script/descriptor.cpp
+++ b/src/script/descriptor.cpp
@@ -2822,7 +2822,7 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index
     return {};
 }
 
-std::unique_ptr<DescriptorImpl> InferMultiA(const CScript& script, ParseScriptContext ctx, const SigningProvider& provider)
+std::unique_ptr<DescriptorImpl> InferMultiA(const CScript& script, const SigningProvider& provider)
 {
     auto match = MatchMultiA(script);
     if (!match) return {};
@@ -2846,7 +2846,7 @@ std::unique_ptr<DescriptorImpl> InferScript(const CScript& script, ParseScriptCo
     }
 
     if (ctx == ParseScriptContext::P2TR) {
-        auto ret = InferMultiA(script, ctx, provider);
+        auto ret = InferMultiA(script, provider);
         if (ret) return ret;
     }
 

The `ctx` parameter in `InferMultiA` is now dead code too: <details> <summary>git diff on 5935ae60a8</summary> ```diff diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp index fc9f17f94c..758a1070b3 100644 --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -2822,7 +2822,7 @@ std::vector<std::unique_ptr<DescriptorImpl>> ParseScript(uint32_t& key_exp_index return {}; } -std::unique_ptr<DescriptorImpl> InferMultiA(const CScript& script, ParseScriptContext ctx, const SigningProvider& provider) +std::unique_ptr<DescriptorImpl> InferMultiA(const CScript& script, const SigningProvider& provider) { auto match = MatchMultiA(script); if (!match) return {}; @@ -2846,7 +2846,7 @@ std::unique_ptr<DescriptorImpl> InferScript(const CScript& script, ParseScriptCo } if (ctx == ParseScriptContext::P2TR) { - auto ret = InferMultiA(script, ctx, provider); + auto ret = InferMultiA(script, provider); if (ret) return ret; } ``` </details>
fanquake (Migrated from github.com) reviewed 2026-12-02 11:21:18 +00:00
fanquake (Migrated from github.com) commented 2026-12-02 11:21:18 +00:00

Thanks, taken.

Thanks, taken.
fanquake (Migrated from github.com) reviewed 2026-12-02 11:21:25 +00:00
fanquake (Migrated from github.com) commented 2026-12-02 11:21:25 +00:00

Thanks, taken.

Thanks, taken.
stickies-v (Migrated from github.com) approved these changes 2026-12-02 12:08:09 +00:00
stickies-v (Migrated from github.com) left a comment

re-ACK 1fdc122104

re-ACK 1fdc122104714fb3c1a32ed47bc3ef6238239bea
stickies-v (Migrated from github.com) commented 2026-12-02 12:07:49 +00:00

Not sure it technically qualifies as dead code, but InterruptHTTPRPC is also a no-op, it just logs the interruption but then doesn't actually do anything. Could be removed here as well I think?

git diff on 1fdc122104
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index ad930f13ed..727af27e25 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -354,11 +354,6 @@ bool StartHTTPRPC(const std::any& context)
     return true;
 }
 
-void InterruptHTTPRPC()
-{
-    LogDebug(BCLog::RPC, "Interrupting HTTP RPC server\n");
-}
-
 void StopHTTPRPC()
 {
     LogDebug(BCLog::RPC, "Stopping HTTP RPC server\n");
diff --git a/src/httprpc.h b/src/httprpc.h
index 32ae90b5d8..41657d3ded 100644
--- a/src/httprpc.h
+++ b/src/httprpc.h
@@ -15,9 +15,6 @@ enum HTTPStatusCode : int;
  * Precondition; HTTP and RPC has been started.
  */
 bool StartHTTPRPC(const std::any& context);
-/** Interrupt HTTP RPC subsystem.
- */
-void InterruptHTTPRPC();
 /** Stop HTTP RPC subsystem.
  * Precondition; HTTP and RPC has been stopped.
  */
diff --git a/src/init.cpp b/src/init.cpp
index 7289aacd5e..f8b5f98d7a 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -296,7 +296,6 @@ void Interrupt(NodeContext& node)
     // Wake any threads that may be waiting for the tip to change.
     if (node.notifications) WITH_LOCK(node.notifications->m_tip_block_mutex, node.notifications->m_tip_block_cv.notify_all());
     InterruptHTTPServer();
-    InterruptHTTPRPC();
     InterruptRPC();
     if (node.tor_controller) {
         node.tor_controller->Interrupt();

Not sure it technically qualifies as dead code, but `InterruptHTTPRPC` is also a no-op, it just logs the interruption but then doesn't actually do anything. Could be removed here as well I think? <details> <summary>git diff on 1fdc122104</summary> ```diff diff --git a/src/httprpc.cpp b/src/httprpc.cpp index ad930f13ed..727af27e25 100644 --- a/src/httprpc.cpp +++ b/src/httprpc.cpp @@ -354,11 +354,6 @@ bool StartHTTPRPC(const std::any& context) return true; } -void InterruptHTTPRPC() -{ - LogDebug(BCLog::RPC, "Interrupting HTTP RPC server\n"); -} - void StopHTTPRPC() { LogDebug(BCLog::RPC, "Stopping HTTP RPC server\n"); diff --git a/src/httprpc.h b/src/httprpc.h index 32ae90b5d8..41657d3ded 100644 --- a/src/httprpc.h +++ b/src/httprpc.h @@ -15,9 +15,6 @@ enum HTTPStatusCode : int; * Precondition; HTTP and RPC has been started. */ bool StartHTTPRPC(const std::any& context); -/** Interrupt HTTP RPC subsystem. - */ -void InterruptHTTPRPC(); /** Stop HTTP RPC subsystem. * Precondition; HTTP and RPC has been stopped. */ diff --git a/src/init.cpp b/src/init.cpp index 7289aacd5e..f8b5f98d7a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -296,7 +296,6 @@ void Interrupt(NodeContext& node) // Wake any threads that may be waiting for the tip to change. if (node.notifications) WITH_LOCK(node.notifications->m_tip_block_mutex, node.notifications->m_tip_block_cv.notify_all()); InterruptHTTPServer(); - InterruptHTTPRPC(); InterruptRPC(); if (node.tor_controller) { node.tor_controller->Interrupt(); ``` </details>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36820
No description provided.