From 47f5e37205ab31ec1cbdcbee1160f6e13b545388 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 7 Nov 2017 23:57:23 +0000 Subject: [PATCH] copy RoundState for event --- consensus/types/state.go | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/consensus/types/state.go b/consensus/types/state.go index 2276d00cc..3fdf81523 100644 --- a/consensus/types/state.go +++ b/consensus/types/state.go @@ -76,21 +76,14 @@ type RoundState struct { // RoundStateEvent returns the H/R/S of the RoundState as an event. func (rs *RoundState) RoundStateEvent() types.EventDataRoundState { + // XXX: copy the RoundState + // if we want to avoid this, we may need synchronous events after all + rs_ := *rs edrs := types.EventDataRoundState{ - Height: rs.Height, - Round: rs.Round, - Step: rs.Step.String(), - // send only fields needed by makeRoundStepMessages - RoundState: &RoundState{ - Height: rs.Height, - Round: rs.Round, - Step: rs.Step, - StartTime: rs.StartTime, - LastCommit: rs.LastCommit, - LockedBlock: rs.LockedBlock, // consensus/state_test.go#L398 - ProposalBlock: rs.ProposalBlock, // consensus/state_test.go#L253 - ProposalBlockParts: rs.ProposalBlockParts, - }, + Height: rs.Height, + Round: rs.Round, + Step: rs.Step.String(), + RoundState: &rs_, } return edrs }