Skip to content
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

fix: peer manager nil pointer #264

Merged
merged 1 commit into from
Feb 25, 2025
Merged

fix: peer manager nil pointer #264

merged 1 commit into from
Feb 25, 2025

Conversation

blindchaser
Copy link
Contributor

@blindchaser blindchaser commented Feb 24, 2025

Describe your changes and provide context

  • fix peer manager goroutine crash when getting non-existing peer node

Testing performed to validate your change

case PeerStatusGood:
m.store.peers[pu.NodeID].MutableScore++
if peer, ok := m.store.peers[pu.NodeID]; ok {
peer.MutableScore++
Copy link
Contributor

Choose a reason for hiding this comment

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

shoudl we initialize this if it doesn't exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes on line 1014 we have:

if _, ok := m.store.peers[pu.NodeID]; !ok { m.store.peers[pu.NodeID] = &peerInfo{} }

@blindchaser blindchaser merged commit 288d6ba into main Feb 25, 2025
21 of 22 checks passed
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.

3 participants