Skip to content

Commit a7fd2a6

Browse files
[Consensus] Log warnings if server module is not enabled (#679)
## 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)
1 parent fa106f5 commit a7fd2a6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

consensus/doc/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.0.0.47] - 2023-04-17
11+
12+
- Log warnings in `handleStateSyncMessage()`
13+
1014
## [0.0.0.46] - 2023-04-13
1115

1216
- Utilise the `TxResult` protobuf from `shared/core/types`

consensus/state_sync_handler.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.Sta
3838
case *typesCons.StateSyncMessage_MetadataReq:
3939
m.logger.Info().Str("proto_type", "MetadataRequest").Msg("Handling StateSyncMessage MetadataReq")
4040
if !m.serverModeEnabled {
41-
return fmt.Errorf("server module is not enabled")
41+
m.logger.Warn().Msg("Node's server module is not enabled")
42+
return nil
4243
}
4344
return m.stateSync.HandleStateSyncMetadataRequest(stateSyncMessage.GetMetadataReq())
4445
case *typesCons.StateSyncMessage_MetadataRes:
@@ -48,7 +49,8 @@ func (m *consensusModule) handleStateSyncMessage(stateSyncMessage *typesCons.Sta
4849
case *typesCons.StateSyncMessage_GetBlockReq:
4950
m.logger.Info().Str("proto_type", "GetBlockRequest").Msg("Handling StateSyncMessage GetBlockRequest")
5051
if !m.serverModeEnabled {
51-
return fmt.Errorf("server module is not enabled")
52+
m.logger.Warn().Msg("Node's server module is not enabled")
53+
return nil
5254
}
5355
return m.stateSync.HandleGetBlockRequest(stateSyncMessage.GetGetBlockReq())
5456
case *typesCons.StateSyncMessage_GetBlockRes:

0 commit comments

Comments
 (0)