forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: separate network and consensus logic 1/N [instantsend] #6959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PastaPastaPasta
merged 5 commits into
dashpay:develop
from
knst:refactor-peermanager-handlers-is
Nov 18, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
466e2a2
feat: introduce new bridge interface NetHandler to separate network l…
knst 90d7879
refactor: use NetHandler class to separate instantsend logic and netw…
knst 3c26523
fix: update log records from CInstantSendManager for NetInstantSend i…
knst a26a974
perf: std::move a shared_ptr with islock in ProcessMessage
knst d4d64f6
fix: don't remove handlers too early
knst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify llmq_ctx initialization before dereferencing.
The code dereferences
node.llmq_ctx->ismanandnode.llmq_ctx->qmanwithout checking ifllmq_ctxis null. While the pattern throughout this section suggestsllmq_ctxis expected to be initialized by this point, consider adding an assertion to make the assumption explicit:This would make the code's expectations clear and provide better diagnostics if the assumption is violated.
Based on learnings
🏁 Script executed:
Length of output: 2417
Looking at the script output, I need to understand the Node structure definition and verify where
llmq_ctxis initialized before it's dereferenced. Let me search for more context.🏁 Script executed:
Length of output: 107
🏁 Script executed:
Length of output: 2444
🏁 Script executed:
Length of output: 1995
🏁 Script executed:
Length of output: 4889
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 107
🏁 Script executed:
Length of output: 165
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 69
🏁 Script executed:
Length of output: 3909
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 189
🏁 Script executed:
Length of output: 4254
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 85
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 1240
🏁 Script executed:
Length of output: 64
🏁 Script executed:
Length of output: 241
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 79
Add explicit assertion for llmq_ctx to document precondition.
The code at line 2200 dereferences
node.llmq_ctx->ismanandnode.llmq_ctx->qmanwithout checking ifllmq_ctxis null. While the initialization flow ensuresllmq_ctxis created beforeAppInitMainis called and remains non-null throughout this phase (evidenced by similar dereferences at lines 2172, 2186, 2195, 2295 without checks), there is no explicit assertion to document this precondition.Adding an assertion makes the assumption clear and provides better diagnostics:
This assertion should be placed before the first dereference of
llmq_ctxmembers inAppInitMain(e.g., before line 2172).🤖 Prompt for AI Agents