Skip to content

backport: Merge bitcoin#29404, 28144, 28118#7124

Open
vijaydasmp wants to merge 3 commits intodashpay:developfrom
vijaydasmp:Feb_2026_04
Open

backport: Merge bitcoin#29404, 28144, 28118#7124
vijaydasmp wants to merge 3 commits intodashpay:developfrom
vijaydasmp:Feb_2026_04

Conversation

@vijaydasmp
Copy link

@vijaydasmp vijaydasmp commented Feb 2, 2026

bitcoin backporting
🤕➡️🛌🩹➡️💪⚡💻🔙

@github-actions
Copy link

github-actions bot commented Feb 2, 2026

⚠️ Potential Merge Conflicts Detected

This PR has potential conflicts with the following open PRs:

Please coordinate with the authors of these PRs to avoid merge conflicts.

@vijaydasmp vijaydasmp changed the title Backport: Merge bitcoin/bitcoin#29404 backport : Merge bitcoin#29404 Feb 2, 2026
@vijaydasmp vijaydasmp changed the title backport : Merge bitcoin#29404 backport: Merge bitcoin#29404 Feb 2, 2026
@vijaydasmp vijaydasmp changed the title backport: Merge bitcoin#29404 backport: Merge bitcoin#29404, 28144, 28118 Feb 3, 2026
@github-actions
Copy link

This pull request has conflicts, please rebase.

@github-actions
Copy link

This pull request has conflicts, please rebase.

@vijaydasmp vijaydasmp force-pushed the Feb_2026_04 branch 4 times, most recently from 2779ae2 to 2cd9132 Compare February 26, 2026 08:22
@vijaydasmp vijaydasmp marked this pull request as ready for review February 26, 2026 11:28
@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

Walkthrough

The diff standardizes conditional inclusion of <config/bitcoin-config.h> (guarded by HAVE_CONFIG_H) across many source files while removing it from several headers. Most changes are compile-time include adjustments with no behavioral changes. Functional edits in src/rpc/node.cpp replace optional GetContext usage with EnsureAnyNodeContext(request.context) and update RPC handlers to call setMockTime on each chain_client and to call MockForward on the node scheduler followed by SyncWithValidationInterfaceQueue(). Tests and P2P utilities include small changes to peer selection and addr-message handling.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant RPC_Client
participant RPC_Handler as RPC Handler
participant NodeContext as NodeContext
participant ChainClients as ChainClients[*]
participant Scheduler as Scheduler
participant ValIntQueue as ValidationInterfaceQueue

RPC_Client->>RPC_Handler: send "setmocktime" request
RPC_Handler->>NodeContext: EnsureAnyNodeContext(request.context)
Note right of NodeContext: returns const NodeContext reference
RPC_Handler->>ChainClients: for each chain_client -> setMockTime(t)
ChainClients-->>RPC_Handler: ack
RPC_Handler-->>RPC_Client: return result

mermaid
sequenceDiagram
participant RPC_Client
participant RPC_Handler as RPC Handler
participant NodeContext as NodeContext
participant Scheduler as Scheduler
participant ValIntQueue as ValidationInterfaceQueue

RPC_Client->>RPC_Handler: send "mockscheduler" request
RPC_Handler->>NodeContext: EnsureAnyNodeContext(request.context)
RPC_Handler->>Scheduler: MockForward(delta)
Scheduler-->>RPC_Handler: ack
RPC_Handler->>ValIntQueue: SyncWithValidationInterfaceQueue()
ValIntQueue-->>RPC_Handler: synced
RPC_Handler-->>RPC_Client: return result

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the three Bitcoin backports being merged (bitcoin#29404, 28144, 28118), which matches the commit messages and primary changes in the PR.
Description check ✅ Passed The description mentions 'bitcoin backporting' which relates to the changeset's purpose of merging Bitcoin upstream changes, though it is minimal and uses only emojis for elaboration.

✏️ 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.

fanquake added 3 commits March 4, 2026 05:25
9d1dbbd scripted-diff: Fix bitcoin_config_h includes (TheCharlatan)

Pull request description:

  As mentioned in bitcoin#26924 (comment) and bitcoin#29263 (comment), it is currently not safe to remove `bitcoin-config.h` includes from headers because some unrelated file might be depending on it.

  See also bitcoin#26972 for discussion.

  Solve this by including the file directly everywhere it's required, regardless of whether or not it's already included by another header.

  There should be no functional change here, but it will allow us to safely remove includes from headers in the future.

  ~I'm afraid it's a bit tedious to reproduce these commits, but it's reasonably straightforward:~
  Edit: See note below

  ```bash
  # All commands executed from the src/ subdir.

  # Collect all tokens from bitcoin-config.h.in
  # Isolate the tokens and remove blank lines
  # Replace newlines with | and remove the last trailing one
  # Collect all files which use these tokens
  # Filter out subprojects (proper forwarding can be verified from Makefiles)
  # Filter out .rc files
  # Save to a text file
  git grep -E -l `grep undef config/bitcoin-config.h.in | cut -d" " -f2 | grep -v '^$' | tr '\n' '|' | sed 's/|$//'` | grep -v -e "^leveldb/" -e "^secp256k1/" -e "^crc32c/" -e "^minisketch/" -e "^Makefile" -e "\.rc$" > files-with-config-include.txt

  # Find all files from the above list which don't include bitcoin-config.h
  git grep -L -E "config/bitcoin-config.h" -- `cat files-with-config-include.txt`

  # Include them manually with the exception of some files in crypto:
  # crypto/sha256_arm_shani.cpp crypto/sha256_avx2.cpp crypto/sha256_sse41.cpp crypto/sha256_x86_shani.cpp
  # These are exceptions which don't use bitcoin-config.h, rather the Makefile.am adds these cppflags manually.

  # Commit changes. This should match the first commit of this PR.

  # Use the same search as above to find all files which DON'T use any config tokens
  git grep -E -L `grep undef config/bitcoin-config.h.in | cut -d" " -f2 | grep -v '^$' | tr '\n' '|' | sed 's/|$//'` | grep -v -e "^leveldb/" -e "^secp256k1/" -e "^crc32c/" -e "^minisketch/" -e "^Makefile" -e "\.rc$" > files-without-config-include.txt

  # Manually remove the includes and commit changes. This should match the second commit of this PR.
  ```

  Edit: I'll keep this old description for posterity, but the manual approach has been replaced with a scripted diff from TheCharlatan

ACKs for top commit:
  maflcko:
    ACK 9d1dbbd 🚪
  TheCharlatan:
    ACK 9d1dbbd
  hebasto:
    ACK 9d1dbbd, I have reviewed the code and it looks OK.
  fanquake:
    ACK 9d1dbbd

Tree-SHA512: f11ddc4ae6a887f96b954a6b77f310558ddb271088a3fda3edc833669c4251b7f392515224bbb8e5f67eb2c799b4ffed3b07d96454e82ec635c686d0df545872
…ching.py

8a20f76 test: drop duplicate getaddrs from p2p_getaddr_caching (Martin Zumsande)
feb0096 test: fix intermittent failure in p2p_getaddr_caching (Martin Zumsande)

Pull request description:

  Fixes bitcoin#28133

  In the consistency check, it's not enough to check that our address/port is unique, only the combination of source and target must be unique. Otherwise, the OS may reuse ports for connections to different `-addrbind`, which was happening in the failed runs.

  While at it, the second commit cleans up duplicate `getaddr` messages in `p2p_getaddr_caching.py` that do nothing but generate `Ignoring repeated "getaddr"` log messages (and cleans up some whitespace the python linter complains about).

ACKs for top commit:
  vasild:
    ACK 8a20f76

Tree-SHA512: eabe4727d7887f729074076f6333a918bba8cb34b8e3baaa83f167b441b0daa24f7c4824abcf03a9538a2ef14b2d826ff19aeffcb93a6c20735253a9678aac9c

Fixing Linting error - 'time' module imported but not used
…ckscheduler RPC

fabef12 refactor: Use EnsureAnyNodeContext (MarcoFalke)
fa16406 test: Add SyncWithValidationInterfaceQueue to mockscheduler RPC (MarcoFalke)

Pull request description:

  There should be no risk or downside in adding a call to `SyncWithValidationInterfaceQueue` here. In fact, it will make tests less brittle. For example,

  * If one sets the timeouts in `test/functional/feature_fee_estimation.py` to `0`, on `master` the test will fail and here it will pass.
  * It may avoid a rare (theoretic) intermittent issue in https://github.com/bitcoin/bitcoin/pull/28108/files#r1268966663

ACKs for top commit:
  TheCharlatan:
    ACK fabef12
  furszy:
    Code review ACK fabef12. Convinced by checking all current tests usages.

Tree-SHA512: c9e9a536a8721d1b3f267a66b40578b34948892301affdcad121ef8e02bf17037305d0dd53aa94b1b064753e66f9cfb31823b916b707a9d812627f502b818003
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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/rpc/node.cpp (1)

7-11: Include order: config/bitcoin-config.h should be included before other headers.

The config header defines macros (e.g., HAVE_MALLOC_INFO used on line 43) that may affect how subsequent headers behave. Placing the config include after <addressindex.h> violates the standard pattern where config headers come first.

Suggested fix
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
 `#include` <addressindex.h>
-#if defined(HAVE_CONFIG_H)
-#include <config/bitcoin-config.h>
-#endif
-
 `#include` <chainparams.h>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/rpc/node.cpp` around lines 7 - 11, Move the config include so it appears
before any other headers: place `#if` defined(HAVE_CONFIG_H) / `#include`
<config/bitcoin-config.h> at the top of src/rpc/node.cpp (above `#include`
<addressindex.h>) so macros like HAVE_MALLOC_INFO are defined before other
headers are processed; update the include block around the existing preprocessor
directives accordingly to ensure config is included first.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/functional/test_framework/test_node.py`:
- Line 723: The peer matching assumes addrbind is always present and can raise
KeyError; update the filter in test_node.py where getpeerinfo() is iterated (the
list comprehension that builds info) to safely handle missing addrbind by using
peer.get("addrbind") (or "in" check) when comparing to dst_addr_and_port, so
replace peer["addrbind"] == dst_addr_and_port with a safe check such as
peer.get("addrbind") == dst_addr_and_port to avoid KeyError for peers without
addrbind while still matching addr and addrbind correctly for our_addr_and_port
and dst_addr_and_port.

---

Nitpick comments:
In `@src/rpc/node.cpp`:
- Around line 7-11: Move the config include so it appears before any other
headers: place `#if` defined(HAVE_CONFIG_H) / `#include` <config/bitcoin-config.h>
at the top of src/rpc/node.cpp (above `#include` <addressindex.h>) so macros like
HAVE_MALLOC_INFO are defined before other headers are processed; update the
include block around the existing preprocessor directives accordingly to ensure
config is included first.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd9132 and 10a457b.

📒 Files selected for processing (56)
  • src/addrdb.cpp
  • src/addrman.cpp
  • src/bench/verify_script.cpp
  • src/bench/wallet_create.cpp
  • src/bench/wallet_loading.cpp
  • src/clientversion.cpp
  • src/compat/compat.h
  • src/crypto/chacha20poly1305.cpp
  • src/crypto/muhash.h
  • src/crypto/sha256.cpp
  • src/netaddress.h
  • src/netbase.h
  • src/qt/addressbookpage.cpp
  • src/qt/askpassphrasedialog.cpp
  • src/qt/bitcoingui.cpp
  • src/qt/coincontroldialog.cpp
  • src/qt/guiutil.cpp
  • src/qt/modaloverlay.cpp
  • src/qt/notificator.cpp
  • src/qt/paymentserver.cpp
  • src/qt/paymentserver.h
  • src/qt/sendcoinsentry.cpp
  • src/qt/sendcoinsrecipient.h
  • src/qt/test/apptests.cpp
  • src/qt/test/optiontests.cpp
  • src/qt/transactiondesc.cpp
  • src/qt/walletmodel.cpp
  • src/qt/walletmodel.h
  • src/qt/walletmodeltransaction.cpp
  • src/random.cpp
  • src/rest.cpp
  • src/rpc/external_signer.cpp
  • src/rpc/mining.cpp
  • src/rpc/node.cpp
  • src/rpc/register.h
  • src/rpc/server.cpp
  • src/rpc/util.cpp
  • src/serialize.h
  • src/support/lockedpool.cpp
  • src/sync.cpp
  • src/test/script_tests.cpp
  • src/test/system_tests.cpp
  • src/test/util/setup_common.cpp
  • src/validation.cpp
  • src/validation.h
  • src/wallet/init.cpp
  • src/wallet/rpc/addresses.cpp
  • src/wallet/rpc/backup.cpp
  • src/wallet/rpc/wallet.cpp
  • src/wallet/sqlite.cpp
  • src/wallet/test/db_tests.cpp
  • src/wallet/test/util.h
  • src/wallet/walletdb.cpp
  • src/warnings.cpp
  • test/functional/p2p_getaddr_caching.py
  • test/functional/test_framework/test_node.py
💤 Files with no reviewable changes (19)
  • src/netaddress.h
  • src/qt/sendcoinsentry.cpp
  • src/validation.h
  • src/support/lockedpool.cpp
  • src/qt/sendcoinsrecipient.h
  • src/qt/addressbookpage.cpp
  • src/qt/transactiondesc.cpp
  • src/qt/paymentserver.cpp
  • src/crypto/muhash.h
  • src/netbase.h
  • src/qt/walletmodel.h
  • src/qt/askpassphrasedialog.cpp
  • src/qt/test/apptests.cpp
  • src/qt/walletmodeltransaction.cpp
  • src/sync.cpp
  • src/qt/walletmodel.cpp
  • src/qt/paymentserver.h
  • src/qt/coincontroldialog.cpp
  • src/compat/compat.h
🚧 Files skipped from review as they are similar to previous changes (23)
  • src/wallet/test/util.h
  • src/random.cpp
  • src/serialize.h
  • src/wallet/rpc/addresses.cpp
  • src/bench/wallet_loading.cpp
  • src/wallet/rpc/wallet.cpp
  • src/rpc/mining.cpp
  • src/wallet/sqlite.cpp
  • src/bench/verify_script.cpp
  • src/wallet/init.cpp
  • src/qt/modaloverlay.cpp
  • src/rest.cpp
  • src/test/system_tests.cpp
  • src/test/script_tests.cpp
  • src/qt/guiutil.cpp
  • src/qt/notificator.cpp
  • src/addrdb.cpp
  • src/crypto/sha256.cpp
  • src/wallet/rpc/backup.cpp
  • src/rpc/server.cpp
  • src/rpc/external_signer.cpp
  • test/functional/p2p_getaddr_caching.py
  • src/crypto/chacha20poly1305.cpp

our_addr_and_port = f"{sockname[0]}:{sockname[1]}"
info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port]
dst_addr_and_port = f"{p2p_conn.dstaddr}:{p2p_conn.dstport}"
info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port and peer["addrbind"] == dst_addr_and_port]
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Handle optional addrbind safely in peer matching.

Line 723 assumes peer["addrbind"] always exists, but getpeerinfo documents addrbind as optional (src/rpc/net.cpp Line 108-115, 207-211). This can throw KeyError and reintroduce intermittent test failures.

Proposed fix
-            info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port and peer["addrbind"] == dst_addr_and_port]
+            peers = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port]
+            info = [peer for peer in peers if peer.get("addrbind") == dst_addr_and_port]
+            if not info:
+                # Fallback for peers where addrbind is not reported by getpeerinfo.
+                info = peers
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
info = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port and peer["addrbind"] == dst_addr_and_port]
peers = [peer for peer in self.getpeerinfo() if peer["addr"] == our_addr_and_port]
info = [peer for peer in peers if peer.get("addrbind") == dst_addr_and_port]
if not info:
# Fallback for peers where addrbind is not reported by getpeerinfo.
info = peers
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/functional/test_framework/test_node.py` at line 723, The peer matching
assumes addrbind is always present and can raise KeyError; update the filter in
test_node.py where getpeerinfo() is iterated (the list comprehension that builds
info) to safely handle missing addrbind by using peer.get("addrbind") (or "in"
check) when comparing to dst_addr_and_port, so replace peer["addrbind"] ==
dst_addr_and_port with a safe check such as peer.get("addrbind") ==
dst_addr_and_port to avoid KeyError for peers without addrbind while still
matching addr and addrbind correctly for our_addr_and_port and
dst_addr_and_port.

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