Browse Source

consensus: cswal doesnt write any consensus msgs in light mode

pull/205/head
Ethan Buchman 9 years ago
parent
commit
2215ad74ff
1 changed files with 6 additions and 7 deletions
  1. +6
    -7
      consensus/wal.go

+ 6
- 7
consensus/wal.go View File

@ -61,21 +61,20 @@ func NewWAL(file string, light bool) (*WAL, error) {
} }
// called in newStep and for each pass in receiveRoutine // called in newStep and for each pass in receiveRoutine
func (wal *WAL) Save(msg ConsensusLogMessageInterface) {
func (wal *WAL) Save(clm ConsensusLogMessageInterface) {
if wal != nil { if wal != nil {
if wal.light { if wal.light {
if m, ok := msg.(msgInfo); ok {
if _, ok := m.Msg.(*BlockPartMessage); ok {
return
}
// in light mode we only write new steps and timeouts (no votes, proposals, block parts)
if _, ok := clm.(msgInfo); ok {
return
} }
} }
var n int var n int
var err error var err error
wire.WriteJSON(ConsensusLogMessage{time.Now(), msg}, wal.fp, &n, &err)
wire.WriteJSON(ConsensusLogMessage{time.Now(), clm}, wal.fp, &n, &err)
wire.WriteTo([]byte("\n"), wal.fp, &n, &err) // one message per line wire.WriteTo([]byte("\n"), wal.fp, &n, &err) // one message per line
if err != nil { if err != nil {
PanicQ(Fmt("Error writing msg to consensus wal. Error: %v \n\nMessage: %v", err, msg))
PanicQ(Fmt("Error writing msg to consensus wal. Error: %v \n\nMessage: %v", err, clm))
} }
} }
} }


Loading…
Cancel
Save