mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
54d888ba70
This seriously improves the serialization/deserialization performance for several reasons: * no time spent in `binary` reflection * no memory allocations being made on every read/write * uses fast ReadBytes everywhere it's appropriate It also makes Fixed8 Serializable just for convenience.
29 lines
822 B
Go
29 lines
822 B
Go
package consensus
|
|
|
|
import (
|
|
"github.com/CityOfZion/neo-go/pkg/io"
|
|
"github.com/nspcc-dev/dbft/payload"
|
|
)
|
|
|
|
// recoveryRequest represents dBFT RecoveryRequest message.
|
|
type recoveryRequest struct {
|
|
timestamp uint32
|
|
}
|
|
|
|
var _ payload.RecoveryRequest = (*recoveryRequest)(nil)
|
|
|
|
// DecodeBinary implements io.Serializable interface.
|
|
func (m *recoveryRequest) DecodeBinary(r *io.BinReader) {
|
|
m.timestamp = r.ReadU32LE()
|
|
}
|
|
|
|
// EncodeBinary implements io.Serializable interface.
|
|
func (m *recoveryRequest) EncodeBinary(w *io.BinWriter) {
|
|
w.WriteU32LE(m.timestamp)
|
|
}
|
|
|
|
// Timestamp implements payload.RecoveryRequest interface.
|
|
func (m *recoveryRequest) Timestamp() uint32 { return m.timestamp }
|
|
|
|
// SetTimestamp implements payload.RecoveryRequest interface.
|
|
func (m *recoveryRequest) SetTimestamp(ts uint32) { m.timestamp = ts }
|