rpc: remove duplicate avgfeerate key in getblockstats #37033

Manually merged
fanquake merged 2 commits from getblockstats_dup_avgfeerate into master 2026-12-03 10:42:40 +00:00 AGit
fanquake commented 2026-12-01 18:12:04 +00:00 (Migrated from github.com)
No description provided.
DrahtBot commented 2026-12-01 18:12:16 +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 maflcko, nervana21
Stale ACK Conradgabe

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:

  • #36167 (build: Enable -Wunused by fanquake)

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/37033 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/37033.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/37033#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 | [maflcko](https://github.com/bitcoin/bitcoin/pull/37033#issuecomment-7343581766), [nervana21](https://github.com/bitcoin/bitcoin/pull/37033#issuecomment-7351675504) | | Stale ACK | [Conradgabe](https://github.com/bitcoin/bitcoin/pull/37033#issuecomment-7337092329) | 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: * [#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) 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

I found no actionable issues in this static review.


Reviewed: 22d03bf4e613 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:e1a29e5e677c47d383756f0fcf8f3760725c91d1104dd3ccb2f333b6217eba26:47880f5569fd2047d249266f337c4f2a509adf7d96c3ccb1c7644c2c2a650bff --> <!-- ralph-base:cc27c50e87f348c154512a15f53cd552d4cd8844 --> <!-- ralph-head:22d03bf4e6131eba4703e8c220a606d4775c0b06 --> <!-- ralph-case:d0bcbe3ddbd047946cf05badca414ad17e2be9d001e67d895a4b199420d8c175 --> I found no actionable issues in this static review. <!-- Review tier: standard --> --- Reviewed: [`22d03bf4e613`](<https://git.fish.foo/bitcoin/bitcoin/commit/22d03bf4e6131eba4703e8c220a606d4775c0b06>) · [Review report](<https://review.fish.foo/report/37033-22d03bf4e6131eba4703e8c220a606d4775c0b06-3429-2.html>) · [Previous reports](<https://review.fish.foo/traces/37033/>) [permalink](<https://review.fish.foo/report/37033-22d03bf4e6131eba4703e8c220a606d4775c0b06-3429-2.html>)
nervana21 commented 2026-12-01 21:32:28 +00:00 (Migrated from github.com)
ACK bf07fa3ea41595e8493e0ad70e5ae4bb31bc6c76
Conradgabe commented 2026-12-02 06:30:31 +00:00 (Migrated from github.com)
ACK bf07fa3ea41595e8493e0ad70e5ae4bb31bc6c76
maflcko (Migrated from github.com) reviewed 2026-12-02 07:40:17 +00:00
maflcko (Migrated from github.com) left a comment

lgtm ACK bf07fa3ea4

lgtm ACK bf07fa3ea41595e8493e0ad70e5ae4bb31bc6c76
maflcko (Migrated from github.com) commented 2026-12-02 07:38:43 +00:00

nit: While touching, you could also inline as a lambda:

diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index e3b72dc..7530588 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1979,10 +1979,2 @@ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES],
 
-template<typename T>
-static inline bool SetHasKeys(const std::set<T>& set) {return false;}
-template<typename T, typename Tk, typename... Args>
-static inline bool SetHasKeys(const std::set<T>& set, const Tk& key, const Args&... args)
-{
-    return (set.contains(key)) || SetHasKeys(set, args...);
-}
-
 // outpoint (needed for the utxo index) + nHeight|fCoinBase
@@ -2071,2 +2063,6 @@ static RPCMethod getblockstats()
 
+    const auto has_any_stat = [&stats](const auto&... keys) {
+        return (stats.contains(keys) || ...);
+    };
+
     const CBlock& block = GetBlockChecked(chainman.m_blockman, pindex);

(etc)

nit: While touching, you could also inline as a lambda: ```diff diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index e3b72dc..7530588 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1979,10 +1979,2 @@ void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], -template<typename T> -static inline bool SetHasKeys(const std::set<T>& set) {return false;} -template<typename T, typename Tk, typename... Args> -static inline bool SetHasKeys(const std::set<T>& set, const Tk& key, const Args&... args) -{ - return (set.contains(key)) || SetHasKeys(set, args...); -} - // outpoint (needed for the utxo index) + nHeight|fCoinBase @@ -2071,2 +2063,6 @@ static RPCMethod getblockstats() + const auto has_any_stat = [&stats](const auto&... keys) { + return (stats.contains(keys) || ...); + }; + const CBlock& block = GetBlockChecked(chainman.m_blockman, pindex); ``` (etc)
fanquake (Migrated from github.com) reviewed 2026-12-02 10:54:53 +00:00
fanquake (Migrated from github.com) commented 2026-12-02 10:54:53 +00:00

Thanks. Added a commit.

Thanks. Added a commit.
maflcko commented 2026-12-02 11:12:26 +00:00 (Migrated from github.com)

review ACK 22d03bf4e6 📻

Show signature

Signature:

untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
trusted comment: review ACK 22d03bf4e6131eba4703e8c220a606d4775c0b06 📻
Agsxae0ngR9E3wSGKzCtWmIIQFBNiF8fkU99s6cg4gA1b26it0i8SZ4mGGuMBGkcQcBgr2xAm8Fm8Ost0V84DQ==
review ACK 22d03bf4e6131eba4703e8c220a606d4775c0b06 📻 <details><summary>Show signature</summary> Signature: ``` untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}" RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM= trusted comment: review ACK 22d03bf4e6131eba4703e8c220a606d4775c0b06 📻 Agsxae0ngR9E3wSGKzCtWmIIQFBNiF8fkU99s6cg4gA1b26it0i8SZ4mGGuMBGkcQcBgr2xAm8Fm8Ost0V84DQ== ``` </details>
nervana21 commented 2026-12-02 16:15:24 +00:00 (Migrated from github.com)
ACK 22d03bf4e6131eba4703e8c220a606d4775c0b06
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!37033
No description provided.