Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMerkleRootNotMatch indicates the merkle root not match error from verifier. ErrMerkleRootNotMatch = errors.New("merkle root not match") // ErrHashValueNotMatch indicates the hash value not match error from verifier. ErrHashValueNotMatch = errors.New("hash value not match") // ErrSignatureNotMatch indicates the signature not match error from verifier. ErrSignatureNotMatch = errors.New("signature not match") )
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { SignedBlockHeader ReadQueries []*types.Ack WriteQueries []*types.Ack }
Block defines a block including a signed block header and its query list.
func (*Block) Sign ¶
func (b *Block) Sign(signer *asymmetric.PrivateKey) (err error)
Sign signs the block.
type BlockHeader ¶
type BlockHeader struct { Version int32 Producer proto.NodeID GenesisHash hash.Hash ParentHash hash.Hash MerkleRoot hash.Hash Timestamp time.Time }
BlockHeader defines a block header.
type DefaultHashSignVerifierImpl ¶
type DefaultHashSignVerifierImpl struct { DataHash hash.Hash Signee *asymmetric.PublicKey Signature *asymmetric.Signature }
DefaultHashSignVerifierImpl defines a default implementation of hashSignVerifier.
func (*DefaultHashSignVerifierImpl) Hash ¶
func (i *DefaultHashSignVerifierImpl) Hash() hash.Hash
Hash implements hashSignVerifier.Hash.
func (*DefaultHashSignVerifierImpl) Sign ¶
func (i *DefaultHashSignVerifierImpl) Sign( obj marshalHasher, signer *asymmetric.PrivateKey) (err error, )
Sign implements hashSignVerifier.Sign.
func (*DefaultHashSignVerifierImpl) Verify ¶
func (i *DefaultHashSignVerifierImpl) Verify(obj marshalHasher) (err error)
Verify implements hashSignVerifier.Verify.
type SignedBlockHeader ¶
type SignedBlockHeader struct { BlockHeader DefaultHashSignVerifierImpl }
SignedBlockHeader defines a block along with its hasher, signer and verifier.
func (*SignedBlockHeader) Sign ¶
func (h *SignedBlockHeader) Sign(signer *asymmetric.PrivateKey) error
Sign signs the block header.
func (*SignedBlockHeader) Verify ¶
func (h *SignedBlockHeader) Verify() error
Verify verifies the block header.
Click to show internal directories.
Click to hide internal directories.