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

[CONSENSUS] Find issue with sending metadata request #548

Merged
merged 21 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
2 changes: 1 addition & 1 deletion consensus/debugging.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func (m *consensusModule) sendGetMetadataStateSyncMessage(_ *messaging.DebugMess
}

for _, val := range validators {
if m.GetNodeAddress() != val.GetAddress() {
if m.GetNodeAddress() == val.GetAddress() {
continue
}
valAddress := cryptoPocket.AddressFromString(val.GetAddress())
Expand Down
4 changes: 4 additions & 0 deletions consensus/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.35] - 2023-02-25

- Fixed bug in `sendGetMetadataStateSyncMessage`

## [0.0.0.34] - 2023-02-24

- Fixed `TestPacemakerCatchupSameStepDifferentRounds` test
Expand Down
4 changes: 2 additions & 2 deletions consensus/state_sync/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func getMessageType(msg *typesCons.StateSyncMessage) string {
case *typesCons.StateSyncMessage_MetadataRes:
return "StateSyncMetadataResponse"
case *typesCons.StateSyncMessage_GetBlockReq:
return "GetBlockRequest"
return "PeerGetBlockRequest"
case *typesCons.StateSyncMessage_GetBlockRes:
return "GetBlockResponse"
return "PeerGetBlockResponse"
default:
return "Unknown"
}
Expand Down
3 changes: 3 additions & 0 deletions consensus/state_sync_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
func (m *consensusModule) HandleStateSyncMessage(stateSyncMessageAny *anypb.Any) error {
m.m.Lock()
defer m.m.Unlock()
m.logger.Info().Msg("Received a state sync message")
gokutheengineer marked this conversation as resolved.
Show resolved Hide resolved

switch stateSyncMessageAny.MessageName() {
case StateSyncMessageContentType:
Expand All @@ -33,13 +34,15 @@ func (m *consensusModule) HandleStateSyncMessage(stateSyncMessageAny *anypb.Any)
func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.StateSyncMessage) error {
switch stateSyncMessage.Message.(type) {
case *typesCons.StateSyncMessage_MetadataReq:
m.logger.Info().Msg("It is a StateSyncMessage_MetadataReq")
gokutheengineer marked this conversation as resolved.
Show resolved Hide resolved
if !m.stateSync.IsServerModEnabled() {
return fmt.Errorf("server module is not enabled")
}
return m.stateSync.HandleStateSyncMetadataRequest(stateSyncMessage.GetMetadataReq())
case *typesCons.StateSyncMessage_MetadataRes:
return m.stateSync.HandleStateSyncMetadataResponse(stateSyncMessage.GetMetadataRes())
case *typesCons.StateSyncMessage_GetBlockReq:
m.logger.Info().Msg("It is a StateSyncMessage_GetBlockReq")
gokutheengineer marked this conversation as resolved.
Show resolved Hide resolved
if !m.stateSync.IsServerModEnabled() {
return fmt.Errorf("server module is not enabled")
}
Expand Down