neoneo-go/pkg/consensus/prepare_response.go

28 lines
793 B
Go
Raw Permalink Normal View History

2019-11-08 15:40:21 +00:00
package consensus
import (
"github.com/nspcc-dev/dbft"
"github.com/nspcc-dev/neo-go/pkg/io"
"github.com/nspcc-dev/neo-go/pkg/util"
2019-11-08 15:40:21 +00:00
)
// prepareResponse represents dBFT PrepareResponse message.
type prepareResponse struct {
2019-11-15 10:32:40 +00:00
preparationHash util.Uint256
2019-11-08 15:40:21 +00:00
}
var _ dbft.PrepareResponse[util.Uint256] = (*prepareResponse)(nil)
2019-11-15 10:32:40 +00:00
// EncodeBinary implements the io.Serializable interface.
2019-11-08 15:40:21 +00:00
func (p *prepareResponse) EncodeBinary(w *io.BinWriter) {
w.WriteBytes(p.preparationHash[:])
2019-11-08 15:40:21 +00:00
}
// DecodeBinary implements the io.Serializable interface.
2019-11-08 15:40:21 +00:00
func (p *prepareResponse) DecodeBinary(r *io.BinReader) {
2019-12-06 15:37:46 +00:00
r.ReadBytes(p.preparationHash[:])
2019-11-08 15:40:21 +00:00
}
2019-11-15 10:32:40 +00:00
// PreparationHash implements the payload.PrepareResponse interface.
2019-11-15 10:32:40 +00:00
func (p *prepareResponse) PreparationHash() util.Uint256 { return p.preparationHash }