-
Notifications
You must be signed in to change notification settings - Fork 22
refactor(rpc,p2p,daemon): improve peer client clarity and type safety #201
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
Conversation
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
…peer inj…" This reverts commit 44a9b6e.
- Rename peerClient to legacyP2PClient for clarity across RPC and daemon - Change InjectPeerForTesting to use *chainhash.Hash instead of string - Refactor handleGetpeerinfo with concurrent peer fetching using WaitGroup - Simplify InjectPeerForTesting using peerRegistry.Put - Use test context for better lifecycle management - Adjust p2p notification logging levels (Block=Info, others=Debug)
Contributor
|
🤖 Claude Code Review Status: Complete Current Review:
History:
|
sugh01
approved these changes
Nov 21, 2025
- Fix critical channel deadlock in handleGetpeerinfo when clients are nil - Replace busy-wait with ticker in WaitForBlockhash test helper - Change t.Errorf to t.Fatalf to properly halt tests on timeout - Add missing newline in multi_node_inject_test.go Printf statement
Changed getPeersFunc to getPeerRegistryFunc in test mocks to match the actual method being called by handleGetpeerinfo after the channel deadlock fix.
Add defensive check in periodicEvaluation to use default 30s interval if SyncCoordinatorPeriodicEvaluationInterval is zero or negative, preventing time.NewTicker panic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
peerClienttolegacyP2PClientfor clarity across RPC and daemon servicesInjectPeerForTestingto use*chainhash.Hashinstead of string for type safetyhandleGetpeerinfowith concurrent peer fetching using WaitGroup for improved performanceInjectPeerForTestingimplementation usingpeerRegistry.Putt.Context()instead ofcontext.Background()for better test lifecycle managementTest plan