panic(fmt.Sprintf("Error writing msg to consensus wal: %v \n\nMessage: %v",err,msg))
wal.Logger.Error("Error writing msg to consensus wal. WARNING: recover may not be possible for the current height",
"err",err,"msg",msg)
returnerr
}
}
returnnil
}
}
// WriteSync is called when we receive a msg from ourselves
// WriteSync is called when we receive a msg from ourselves
// so that we write to disk before sending signed messages.
// so that we write to disk before sending signed messages.
// NOTE: calls fsync()
// NOTE: calls fsync()
func(wal*baseWAL)WriteSync(msgWALMessage){
func(wal*baseWAL)WriteSync(msgWALMessage)error{
ifwal==nil{
ifwal==nil{
return
returnnil
}
iferr:=wal.Write(msg);err!=nil{
returnerr
}
}
wal.Write(msg)
iferr:=wal.FlushAndSync();err!=nil{
iferr:=wal.FlushAndSync();err!=nil{
panic(fmt.Sprintf("Error flushing consensus wal buf to file. Error: %v \n",err))
wal.Logger.Error("WriteSync failed to flush consensus wal. WARNING: may result in creating alternative proposals / votes for the current height iff the node restarted",
"err",err)
returnerr
}
}
returnnil
}
}
// WALSearchOptions are optional arguments to SearchForEndHeight.
// WALSearchOptions are optional arguments to SearchForEndHeight.