2019-11-08 15:40:21 +00:00
|
|
|
package consensus
|
|
|
|
|
2019-11-15 10:32:40 +00:00
|
|
|
import (
|
2024-03-21 19:49:39 +00:00
|
|
|
"github.com/nspcc-dev/dbft"
|
2020-03-03 14:21:42 +00:00
|
|
|
"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 {
|
2020-07-11 07:48:25 +00:00
|
|
|
timestamp uint64
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2024-03-21 19:49:39 +00:00
|
|
|
var _ dbft.RecoveryRequest = (*recoveryRequest)(nil)
|
2019-11-15 10:32:40 +00:00
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (m *recoveryRequest) DecodeBinary(r *io.BinReader) {
|
2020-07-11 07:48:25 +00:00
|
|
|
m.timestamp = r.ReadU64LE()
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2019-11-08 15:40:21 +00:00
|
|
|
func (m *recoveryRequest) EncodeBinary(w *io.BinWriter) {
|
2020-07-11 07:48:25 +00:00
|
|
|
w.WriteU64LE(m.timestamp)
|
2019-11-08 15:40:21 +00:00
|
|
|
}
|
2019-11-15 10:32:40 +00:00
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// Timestamp implements the payload.RecoveryRequest interface.
|
2020-07-11 12:22:14 +00:00
|
|
|
func (m *recoveryRequest) Timestamp() uint64 { return m.timestamp * nsInMs }
|
2019-11-15 10:32:40 +00:00
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// SetTimestamp implements the payload.RecoveryRequest interface.
|
2020-07-11 12:22:14 +00:00
|
|
|
func (m *recoveryRequest) SetTimestamp(ts uint64) { m.timestamp = ts / nsInMs }
|