mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 15:42:54 +00:00
29 lines
839 B
Go
29 lines
839 B
Go
package consensus
|
|
|
|
import (
|
|
"github.com/nspcc-dev/dbft/payload"
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
|
)
|
|
|
|
// recoveryRequest represents dBFT RecoveryRequest message.
|
|
type recoveryRequest struct {
|
|
timestamp uint64
|
|
}
|
|
|
|
var _ payload.RecoveryRequest = (*recoveryRequest)(nil)
|
|
|
|
// DecodeBinary implements io.Serializable interface.
|
|
func (m *recoveryRequest) DecodeBinary(r *io.BinReader) {
|
|
m.timestamp = r.ReadU64LE()
|
|
}
|
|
|
|
// EncodeBinary implements io.Serializable interface.
|
|
func (m *recoveryRequest) EncodeBinary(w *io.BinWriter) {
|
|
w.WriteU64LE(m.timestamp)
|
|
}
|
|
|
|
// Timestamp implements payload.RecoveryRequest interface.
|
|
func (m *recoveryRequest) Timestamp() uint64 { return m.timestamp * nsInMs }
|
|
|
|
// SetTimestamp implements payload.RecoveryRequest interface.
|
|
func (m *recoveryRequest) SetTimestamp(ts uint64) { m.timestamp = ts / nsInMs }
|