Skip to content

Commit

Permalink
[Consensus] Log warnings if server module is not enabled (#679)
Browse files Browse the repository at this point in the history
## Description

Log a warning if the server module is not enabled rather than an error.

## Issue


## Type of change

Please mark the relevant option(s):

- [ ] New feature, functionality or library
- [ ] Bug fix
- [X] Code health or cleanup
- [ ] Major breaking change
- [ ] Documentation
- [ ] Other <!-- add details here if it a different type of change -->

## List of changes

- Update  `handleStateSyncMessage()` to log warnings

## Testing

- [X] `make develop_test`; if any code changes were made
- [ ] [Docker Compose
LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md);
if any major functionality was changed or introduced
- [ ] [k8s
LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md);
if any infrastructure or configuration changes were made


## Required Checklist

- [X] I have performed a self-review of my own code
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have added, or updated, [`godoc` format
comments](https://go.dev/blog/godoc) on touched members (see:
[tip.golang.org/doc/comment](https://tip.golang.org/doc/comment))
- [X] I have tested my changes using the available tooling
- [X] I have updated the corresponding CHANGELOG

### If Applicable Checklist

- [ ] I have updated the corresponding README(s); local and/or global
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have added, or updated,
[mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding
README(s)
- [ ] I have added, or updated, documentation and
[mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*`
if I updated `shared/*`README(s)
  • Loading branch information
gokutheengineer authored Apr 17, 2023
1 parent fa106f5 commit a7fd2a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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.47] - 2023-04-17

- Log warnings in `handleStateSyncMessage()`

## [0.0.0.46] - 2023-04-13

- Utilise the `TxResult` protobuf from `shared/core/types`
Expand Down
6 changes: 4 additions & 2 deletions consensus/state_sync_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.Sta
case *typesCons.StateSyncMessage_MetadataReq:
m.logger.Info().Str("proto_type", "MetadataRequest").Msg("Handling StateSyncMessage MetadataReq")
if !m.serverModeEnabled {
return fmt.Errorf("server module is not enabled")
m.logger.Warn().Msg("Node's server module is not enabled")
return nil
}
return m.stateSync.HandleStateSyncMetadataRequest(stateSyncMessage.GetMetadataReq())
case *typesCons.StateSyncMessage_MetadataRes:
Expand All @@ -48,7 +49,8 @@ func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.Sta
case *typesCons.StateSyncMessage_GetBlockReq:
m.logger.Info().Str("proto_type", "GetBlockRequest").Msg("Handling StateSyncMessage GetBlockRequest")
if !m.serverModeEnabled {
return fmt.Errorf("server module is not enabled")
m.logger.Warn().Msg("Node's server module is not enabled")
return nil
}
return m.stateSync.HandleGetBlockRequest(stateSyncMessage.GetGetBlockReq())
case *typesCons.StateSyncMessage_GetBlockRes:
Expand Down

0 comments on commit a7fd2a6

Please sign in to comment.