neoneo-go/pkg/consensus/recovery_request.go

27 lines
697 B
Go
Raw Normal View History

2019-11-08 15:40:21 +00:00
package consensus
2019-11-15 10:32:40 +00:00
import (
"github.com/nspcc-dev/dbft"
"github.com/nspcc-dev/neo-go/pkg/io"
2019-11-15 10:32:40 +00:00
)
2019-11-08 15:40:21 +00:00
// recoveryRequest represents dBFT RecoveryRequest message.
type recoveryRequest struct {
timestamp uint64
2019-11-08 15:40:21 +00:00
}
var _ dbft.RecoveryRequest = (*recoveryRequest)(nil)
2019-11-15 10:32:40 +00:00
// DecodeBinary implements the io.Serializable interface.
2019-11-08 15:40:21 +00:00
func (m *recoveryRequest) DecodeBinary(r *io.BinReader) {
m.timestamp = r.ReadU64LE()
2019-11-08 15:40:21 +00:00
}
// EncodeBinary implements the io.Serializable interface.
2019-11-08 15:40:21 +00:00
func (m *recoveryRequest) EncodeBinary(w *io.BinWriter) {
w.WriteU64LE(m.timestamp)
2019-11-08 15:40:21 +00:00
}
2019-11-15 10:32:40 +00:00
// Timestamp implements the payload.RecoveryRequest interface.
func (m *recoveryRequest) Timestamp() uint64 { return m.timestamp * nsInMs }