-
Notifications
You must be signed in to change notification settings - Fork 1k
Handle P2P handshake before ChannelsConfig #4248
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
base: dev
Are you sure you want to change the base?
Conversation
|
fixing conflicts |
# Conflicts: # src/Neo/Network/P2P/Peer.cs
|
Bug Context
Fix Mechanics
|
|
This close #4247 ? |
yes, trying to fix the bug for good |
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.
Pull Request Overview
This PR modifies the P2P Peer actor to defer message processing until configuration is received. The key change is implementing message stashing to handle the race condition where peer-to-peer messages (like TCP connections) arrive before the ChannelsConfig message, ensuring proper initialization order.
- Implements
IWithUnboundedStashinterface in thePeerclass to enable message stashing - Adds stashing logic to buffer pre-startup messages until
ChannelsConfigarrives - Adds unit test verifying
Tcp.Connectedmessages are properly deferred and processed after configuration
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Neo/Network/P2P/Peer.cs | Implements stashing mechanism to defer message processing until ChannelsConfig is received |
| tests/Neo.UnitTests/Network/P2P/UT_LocalNode.cs | Adds test case verifying TCP connection messages are properly stashed before configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Test result is not good. Quickly start a privatnet by |
|
OK, I find the issue. It's the config settings. The shell sets "MinDesiredConnections" as 3 makes it hard to ask for more connections. But not sure why this PR makes it worse since the shell still works in the last commit. I set it to 10, then both could work. |
|
Maybe for this 7 nodes consensus it would be better to se it to 5-6 |
|
@Jim8y could you deep into it?
|
|
Do not merge until fix #4254, I am not being able to test |
Yes. I think so. But still confused why it can work previously but now need to modify the config. |

Summary
Testing