From 2215ad74ff4b9c881e9e474e692604f0fe2a0c05 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 5 Mar 2016 21:17:21 -0500 Subject: [PATCH] consensus: cswal doesnt write any consensus msgs in light mode --- consensus/wal.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/consensus/wal.go b/consensus/wal.go index 56bb294e4..b5c79993d 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -61,21 +61,20 @@ func NewWAL(file string, light bool) (*WAL, error) { } // 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.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 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 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)) } } }