github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/consensus/commit.go (about)

     1  package consensus
     2  
     3  import (
     4  	"github.com/nspcc-dev/dbft"
     5  	"github.com/nspcc-dev/neo-go/pkg/io"
     6  )
     7  
     8  // commit represents dBFT Commit message.
     9  type commit struct {
    10  	signature [signatureSize]byte
    11  }
    12  
    13  // signatureSize is an rfc6989 signature size in bytes
    14  // without a leading byte (0x04, uncompressed).
    15  const signatureSize = 64
    16  
    17  var _ dbft.Commit = (*commit)(nil)
    18  
    19  // EncodeBinary implements the io.Serializable interface.
    20  func (c *commit) EncodeBinary(w *io.BinWriter) {
    21  	w.WriteBytes(c.signature[:])
    22  }
    23  
    24  // DecodeBinary implements the io.Serializable interface.
    25  func (c *commit) DecodeBinary(r *io.BinReader) {
    26  	r.ReadBytes(c.signature[:])
    27  }
    28  
    29  // Signature implements the payload.Commit interface.
    30  func (c commit) Signature() []byte { return c.signature[:] }