func (b *Block) VerifyAsGenesis() (err error) {
	if !b.SignedHeader.Producer.IsEmpty() {
		return errors.Wrap(ErrInvalidGenesis, "invalid producer")
	}
	if !b.SignedHeader.GenesisHash.IsEqual(&hash.Hash{}) {
		return errors.Wrap(ErrInvalidGenesis, "invalid genesis hash")
	}
	if !b.SignedHeader.ParentHash.IsEqual(&hash.Hash{}) {
		return errors.Wrap(ErrInvalidGenesis, "invalid parent hash")
	}
	if !b.SignedHeader.MerkleRoot.IsEqual(&hash.Hash{}) {
		return errors.Wrap(ErrInvalidGenesis, "invalid merkle root")
	}
	return b.SignedHeader.VerifyHash()
}
VerifyAsGenesis verifies the block as a genesis block.
package types
import (
	"time"
	"github.com/pkg/errors"
	ca "github.com/SQLess/SQLess/crypto/asymmetric"
	"github.com/SQLess/SQLess/crypto/hash"
	"github.com/SQLess/SQLess/crypto/verifier"
	"github.com/SQLess/SQLess/merkle"
	"github.com/SQLess/SQLess/proto"
)
type Header struct {
	Version     int32
	Producer    proto.NodeID
	GenesisHash hash.Hash
	ParentHash  hash.Hash
	MerkleRoot  hash.Hash
	Timestamp   time.Time
}
type SignedHeader struct {
	Header
	HSV verifier.DefaultHashSignVerifierImpl
}
func (s *SignedHeader) Sign(signer *ca.PrivateKey) error {
	return s.HSV.Sign(&s.Header, signer)
}
func (s *SignedHeader) Verify() error {
	return s.HSV.Verify(&s.Header)
}
func (s *SignedHeader) VerifyHash() error {
	return s.HSV.VerifyHash(&s.Header)
}
func (s *SignedHeader) ComputeHash() error {
	return s.HSV.SetHash(&s.Header)
}
type QueryAsTx struct {
	Request  *Request
	Response *SignedResponseHeader
}
type Block struct {
	SignedHeader SignedHeader
	FailedReqs   []*Request
	QueryTxs     []*QueryAsTx
	Acks         []*SignedAckHeader
}
func (b *Block) CalcNextID() (id uint64, ok bool) {
	for _, v := range b.QueryTxs {
		if v.Request.Header.QueryType == WriteQuery {
			var nid = v.Response.LogOffset + uint64(len(v.Request.Payload.Queries))
			if nid > id {
				id = nid
			}
			ok = true
		}
	}
	return
}
func (b *Block) PackAndSignBlock(signer *ca.PrivateKey) (err error) {
	b.SignedHeader.MerkleRoot = b.computeMerkleRoot()
	return b.SignedHeader.Sign(signer)
}
func (b *Block) PackAsGenesis() (err error) {
	return b.SignedHeader.ComputeHash()
}
func (b *Block) Verify() (err error) {
	if merkleRoot := b.computeMerkleRoot(); !merkleRoot.IsEqual(&b.SignedHeader.MerkleRoot) {
		return ErrMerkleRootVerification
	}
	return b.SignedHeader.Verify()
}