Skip to content

backport: Merge bitcoin/bitcoin#27357, 25977, (partial) 27594, 28583, 27608 #7200

Open
vijaydasmp wants to merge 5 commits intodashpay:developfrom
vijaydasmp:March_2026_6
Open

backport: Merge bitcoin/bitcoin#27357, 25977, (partial) 27594, 28583, 27608 #7200
vijaydasmp wants to merge 5 commits intodashpay:developfrom
vijaydasmp:March_2026_6

Conversation

@vijaydasmp
Copy link

@vijaydasmp vijaydasmp commented Mar 4, 2026

What was done?

Backports from Bitcoin Core v26,

How Has This Been Tested?

Run unit & functional tests

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

fanquake added 2 commits March 4, 2026 21:44
…or other peers

52e5207 p2p: Avoid prematurely clearing download state for other peers (Suhas Daftuar)

Pull request description:

  Avoid letting one peer send us data that clears out the download request (and related timers etc) from another peer.

  The exception is if a block is definitely stored to disk, in which case we'll clear the download state (just as we do for compact blocks).

ACKs for top commit:
  jamesob:
    ACK 52e5207 ([`jamesob/ackr/27608.1.sdaftuar.p2p_avoid_prematurely_cl`](https://github.com/jamesob/bitcoin/tree/ackr/27608.1.sdaftuar.p2p_avoid_prematurely_cl))
  instagibbs:
    ACK 52e5207
  fjahr:
    Code review ACK 52e5207
  mzumsande:
    Code Review ACK 52e5207

Tree-SHA512: 3ee92507edc3303c16c70ca44ba6c28c104afe95196e4b9167032590ed23d4f569f654f8eb8758940bd6536bc9ca810d2a77d2739db386b927e8b3f3cf55cb16
fa05a72 tidy: modernize-use-emplace (MarcoFalke)

Pull request description:

  Constructing a temporary unnamed object only to copy or move it into a container seems both verbose in code and a strict performance penalty.

  Fix both issues via the `modernize-use-emplace` tidy check.

ACKs for top commit:
  Sjors:
    re-utACK fa05a72
  hebasto:
    ACK fa05a72.
  TheCharlatan:
    ACK fa05a72

Tree-SHA512: 4408a094f406e7bf6c1468c2b0798f68f4d952a1253cf5b20bdc648ad7eea4a2c070051fed46d66fd37bce2ce6f85962484a1d32826b7ab8c9baba431eaa2765

Merge bitcoin#28583: refactor: [tidy] modernize-use-emplace

fa05a72 tidy: modernize-use-emplace (MarcoFalke)

Pull request description:

  Constructing a temporary unnamed object only to copy or move it into a container seems both verbose in code and a strict performance penalty.

  Fix both issues via the `modernize-use-emplace` tidy check.

ACKs for top commit:
  Sjors:
    re-utACK fa05a72
  hebasto:
    ACK fa05a72.
  TheCharlatan:
    ACK fa05a72

Tree-SHA512: 4408a094f406e7bf6c1468c2b0798f68f4d952a1253cf5b20bdc648ad7eea4a2c070051fed46d66fd37bce2ce6f85962484a1d32826b7ab8c9baba431eaa2765

Merge bitcoin#28583: refactor: [tidy] modernize-use-emplace

fa05a72 tidy: modernize-use-emplace (MarcoFalke)

Pull request description:

  Constructing a temporary unnamed object only to copy or move it into a container seems both verbose in code and a strict performance penalty.

  Fix both issues via the `modernize-use-emplace` tidy check.

ACKs for top commit:
  Sjors:
    re-utACK fa05a72
  hebasto:
    ACK fa05a72.
  TheCharlatan:
    ACK fa05a72

Tree-SHA512: 4408a094f406e7bf6c1468c2b0798f68f4d952a1253cf5b20bdc648ad7eea4a2c070051fed46d66fd37bce2ce6f85962484a1d32826b7ab8c9baba431eaa2765

Merge bitcoin#28583: refactor: [tidy] modernize-use-emplace

fa05a72 tidy: modernize-use-emplace (MarcoFalke)

Pull request description:

  Constructing a temporary unnamed object only to copy or move it into a container seems both verbose in code and a strict performance penalty.

  Fix both issues via the `modernize-use-emplace` tidy check.

ACKs for top commit:
  Sjors:
    re-utACK fa05a72
  hebasto:
    ACK fa05a72.
  TheCharlatan:
    ACK fa05a72

Tree-SHA512: 4408a094f406e7bf6c1468c2b0798f68f4d952a1253cf5b20bdc648ad7eea4a2c070051fed46d66fd37bce2ce6f85962484a1d32826b7ab8c9baba431eaa2765
@vijaydasmp vijaydasmp force-pushed the March_2026_6 branch 4 times, most recently from bb07fb9 to cf657ae Compare March 4, 2026 18:39
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin/bitcoin#27357, 25977, 27594, 28583, 27608 backport: Merge bitcoin/bitcoin#27357, 25977, (partial) 27594, 28583, 27608 Mar 5, 2026
fanquake added 3 commits March 5, 2026 20:39
fae1d9c refactor: Remove unused GetTimeMillis (MarcoFalke)

Pull request description:

  The function is unused, not type-safe, and does not denote the underlying clock type. So remove it.

ACKs for top commit:
  willcl-ark:
    tACK fae1d9c

Tree-SHA512: 41ea7125d1964192b85a94265be974d02bf1e79b1feb61bff11486dc0ac811745156940ec5cad2ad1f94b653936f8ae563c959c1c4142203a55645fcb83203e8

GetTimeMicros is used in other palces as well

GetSystemTime is used in other places
… with `util::Result`

8aa8f73 refactor: Replace std::optional<bilingual_str> with util::Result (Ryan Ofsky)
5f49cb1 util: Add void support to util::Result (MarcoFalke)

Pull request description:

  Replace uses of `std::optional<bilingual_str>` with `util::Result` as suggested bitcoin#25648 (comment), bitcoin#27632 (comment), bitcoin#27632 (comment), bitcoin#24313 (comment)

ACKs for top commit:
  MarcoFalke:
    very nice ACK 8aa8f73 🏏
  TheCharlatan:
    ACK 8aa8f73
  hebasto:
    ACK 8aa8f73, I have reviewed the code and it looks OK.

Tree-SHA512: 6c2f218bc445184ce93ec2b907e61666a05f26f2c9447f69fcb504aa8291b0c693d913f659dfd19813a9e24615546c72cbe2ca419218fd867ff0694c4a1b6a30

Redundant std::move
…er and rename to m_warningcache

5526849 validation: Move warningcache to ChainstateManager (dimitaracev)

Pull request description:

  Removes `warningcache`  and moves it to `ChainstateManager`. Also removes the respective `TODO`  completely.

ACKs for top commit:
  ajtowns:
    ACK 5526849
  dimitaracev:
    > ACK [5526849](bitcoin@5526849)
  TheCharlatan:
    ACK 5526849
  ryanofsky:
    Code review ACK 5526849

Tree-SHA512: 6869bd7aa4f0b59324e12eb8e3df47f2c9a3f3b0d9b7d45857426ec9e8b71c5573bdcf71db822f8c10aff7d8679a00a4bedc7a256c28f325e744e5d7267b41e9
@vijaydasmp vijaydasmp marked this pull request as ready for review March 5, 2026 15:10
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Walkthrough

This pull request enables the modernize-use-emplace clang-tidy check and applies it throughout the codebase, replacing push_back calls with emplace_back across 40+ files for in-place container construction. It refactors the LoadAddrman function to return util::Result<std::unique_ptr<AddrMan>> instead of using output parameters and optional error types. The Result class template parameter is renamed and enhanced with a default constructor. The RemoveBlockRequest function signature is updated to accept an optional peer identifier for conditional block removal. The global warningcache array is relocated from global scope to per-chainstate storage via ChainstateManager::m_warningcache. Configuration files are updated to exclude nanobench sources and enable the modernize check.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~40 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.59% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description 'bitcoin backports' is vague and generic, lacking specific details about the actual changes made in the pull request. Provide a more descriptive PR title and description that specifically explains what is being backported and why, rather than using a generic term like 'bitcoin backports'.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the PR as a backport of multiple Bitcoin Core commits with specific PR numbers listed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/util/result.h (1)

46-46: Constrain the default constructor to Result<void> using a requires clause.

Line 46 is intended only for void, but it is currently available for all specializations. This default constructor initializes the variant with std::monostate, which is semantically incorrect for Result<non-void> types. Constraining it improves API clarity and prevents accidental misuse.

♻️ Proposed fix
-    Result() : m_variant{std::in_place_index_t<1>{}, std::monostate{}} {}  // constructor for void
+    Result() requires std::is_same_v<M, void>
+        : m_variant{std::in_place_index_t<1>{}, std::monostate{}} {} // constructor for void
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/util/result.h` at line 46, The default constructor currently available
for all Result<T> specializations should be constrained to only Result<void>;
update the constructor declaration for Result() to add a requires clause (e.g.,
requires std::is_void_v<T>) so it only participates when T is void, leaving
other specializations without this monostate constructor; modify the Result()
definition that initializes m_variant{std::in_place_index_t<1>{},
std::monostate{}} to use that requires constraint (or equivalent SFINAE) so
non-void Result<T> cannot be default-constructed into monostate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/util/result.h`:
- Line 46: The default constructor currently available for all Result<T>
specializations should be constrained to only Result<void>; update the
constructor declaration for Result() to add a requires clause (e.g., requires
std::is_void_v<T>) so it only participates when T is void, leaving other
specializations without this monostate constructor; modify the Result()
definition that initializes m_variant{std::in_place_index_t<1>{},
std::monostate{}} to use that requires constraint (or equivalent SFINAE) so
non-void Result<T> cannot be default-constructed into monostate.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6bf73ca4-aba1-482f-9bb9-90fadee4257f

📥 Commits

Reviewing files that changed from the base of the PR and between af926ae and 0c2eedd.

📒 Files selected for processing (38)
  • src/.bear-tidy-config
  • src/.clang-tidy
  • src/addrdb.cpp
  • src/addrdb.h
  • src/bench/block_assemble.cpp
  • src/bench/wallet_loading.cpp
  • src/external_signer.cpp
  • src/httpserver.cpp
  • src/init.cpp
  • src/net_permissions.cpp
  • src/net_processing.cpp
  • src/node/blockstorage.cpp
  • src/qt/rpcconsole.cpp
  • src/rest.cpp
  • src/rpc/blockchain.cpp
  • src/rpc/net.cpp
  • src/rpc/rawtransaction.cpp
  • src/rpc/server.cpp
  • src/script/sign.cpp
  • src/test/addrman_tests.cpp
  • src/test/bip32_tests.cpp
  • src/test/net_tests.cpp
  • src/test/rpc_tests.cpp
  • src/test/settings_tests.cpp
  • src/test/sighash_tests.cpp
  • src/test/txpackage_tests.cpp
  • src/test/util/setup_common.cpp
  • src/test/util/txmempool.cpp
  • src/test/util_tests.cpp
  • src/test/util_threadnames_tests.cpp
  • src/test/validation_block_tests.cpp
  • src/util/result.h
  • src/validation.cpp
  • src/validation.h
  • src/wallet/rpc/backup.cpp
  • src/wallet/salvage.cpp
  • src/wallet/spend.cpp
  • src/wallet/test/wallet_tests.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants