Browse Source

do not send whole round state via eventHub

Fixes

```
WARNING: DATA RACE
Write at 0x00c4200715b8 by goroutine 24:
  github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrevote.func1()
      /go/src/github.com/tendermint/tendermint/consensus/state.go:359 +0x3f
  github.com/tendermint/tendermint/consensus.(*ConsensusState).enterPrevote()
      /go/src/github.com/tendermint/tendermint/consensus/state.go:897 +0x8de
  github.com/tendermint/tendermint/consensus.(*ConsensusState).addProposalBlockPart()
      /go/src/github.com/tendermint/tendermint/consensus/state.go:1303 +0x701
  github.com/tendermint/tendermint/consensus.(*ConsensusState).handleMsg()
      /go/src/github.com/tendermint/tendermint/consensus/state.go:560 +0x88c
  github.com/tendermint/tendermint/consensus.(*ConsensusState).receiveRoutine()
      /go/src/github.com/tendermint/tendermint/consensus/state.go:525 +0x6d2

Previous read at 0x00c4200715b8 by goroutine 19:
  github.com/tendermint/tendermint/consensus.makeRoundStepMessages()
      /go/src/github.com/tendermint/tendermint/consensus/reactor.go:415 +0x192
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).broadcastNewRoundStep()
      /go/src/github.com/tendermint/tendermint/consensus/reactor.go:377 +0x3c
  github.com/tendermint/tendermint/consensus.(*ConsensusReactor).broadcastNewRoundStepsAndVotes.func1()
      /go/src/github.com/tendermint/tendermint/consensus/reactor.go:350 +0x275
```
pull/788/head
Anton Kaliaev 7 years ago
parent
commit
6d18e2f447
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 14 additions and 4 deletions
  1. +14
    -4
      consensus/types/state.go

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

@ -77,10 +77,20 @@ type RoundState struct {
// RoundStateEvent returns the H/R/S of the RoundState as an event.
func (rs *RoundState) RoundStateEvent() types.EventDataRoundState {
edrs := types.EventDataRoundState{
Height: rs.Height,
Round: rs.Round,
Step: rs.Step.String(),
RoundState: rs,
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,
},
}
return edrs
}


Loading…
Cancel
Save