func (b *Block) PackAndSignBlock(signer *ca.PrivateKey) (err error) {
	b.SignedHeader.MerkleRoot = b.computeMerkleRoot()
	return b.SignedHeader.Sign(signer)
}
PackAndSignBlock generates the signature for the Block from the given PrivateKey.
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
}