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

Data race while accessing current peer fixed. #1316

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/node/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ func (n *Network) switchToNewPeerIfRequired() {
if n.isTimeToSwitchPeerWithMaxScore() {
// Node is getting close to the top of the blockchain, it's time to switch on a node with the highest
// score every time it updated.
if np, ok := n.peers.CheckPeerWithMaxScore(n.syncPeer.peer); ok {
if np, ok := n.peers.CheckPeerWithMaxScore(n.syncPeer.GetPeer()); ok {
n.networkInfoCh <- ChangeSyncPeer{Peer: np}
}
} else {
// Node better continue synchronization with one node, switching to new node happens only if the larger
// group of nodes with the highest score appears.
if np, ok := n.peers.CheckPeerInLargestScoreGroup(n.syncPeer.peer); ok {
if np, ok := n.peers.CheckPeerInLargestScoreGroup(n.syncPeer.GetPeer()); ok {
n.networkInfoCh <- ChangeSyncPeer{Peer: np}
}
}
Expand Down
Loading