8000 consensus: rename (*PeerState).ToJSON to MarshalJSON (backport #524) by mergify[bot] · Pull Request #532 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

consensus: rename (*PeerState).ToJSON to MarshalJSON (backport #524) #532

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

Merged
merged 2 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[consensus]` Rename `(*PeerState).ToJSON` to `MarshalJSON` to fix a logging data race
([\#524](https://github.com/cometbft/cometbft/pull/524))
4 changes: 2 additions & 2 deletions consensus/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,8 @@ func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState {
return &prs
}

// ToJSON returns a json of PeerState.
func (ps *PeerState) ToJSON() ([]byte, error) {
// MarshalJSON implements the json.Marshaler interface.
func (ps *PeerState) MarshalJSON() ([]byte, error) {
ps.mtx.Lock()
defer ps.mtx.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion rpc/core/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func DumpConsensusState(ctx *rpctypes.Context) (*ctypes.ResultDumpConsensusState
if !ok { // peer does not have a state yet
continue
}
peerStateJSON, err := peerState.ToJSON()
peerStateJSON, err := peerState.MarshalJSON()
if err != nil {
return nil, err
}
Expand Down
0