2021-02-02 09:34:27 +00:00
|
|
|
package stateroot
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/io"
|
|
|
|
)
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// Vote represents a vote message.
|
2021-02-02 09:34:27 +00:00
|
|
|
type Vote struct {
|
|
|
|
ValidatorIndex int32
|
|
|
|
Height uint32
|
|
|
|
Signature []byte
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// EncodeBinary implements the io.Serializable interface.
|
2021-02-02 09:34:27 +00:00
|
|
|
func (p *Vote) EncodeBinary(w *io.BinWriter) {
|
|
|
|
w.WriteU32LE(uint32(p.ValidatorIndex))
|
|
|
|
w.WriteU32LE(p.Height)
|
|
|
|
w.WriteVarBytes(p.Signature)
|
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// DecodeBinary implements the io.Serializable interface.
|
2021-02-02 09:34:27 +00:00
|
|
|
func (p *Vote) DecodeBinary(r *io.BinReader) {
|
|
|
|
p.ValidatorIndex = int32(r.ReadU32LE())
|
|
|
|
p.Height = r.ReadU32LE()
|
|
|
|
p.Signature = r.ReadVarBytes(keys.SignatureLen)
|
|
|
|
}
|