Browse Source

copy RoundState for event

pull/788/head
Ethan Buchman 7 years ago
parent
commit
47f5e37205
1 changed files with 7 additions and 14 deletions
  1. +7
    -14
      consensus/types/state.go

+ 7
- 14
consensus/types/state.go View File

@ -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
}


Loading…
Cancel
Save