block

package
v0.0.0-...-4701ab3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: LGPL-3.0 Imports: 10 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExceedTransactionCount        = errors.New("exceed transaction count")
	ErrExceedSignatureCount          = errors.New("exceed signature count")
	ErrMismatchSignaturesCount       = errors.New("mismatch signatures count")
	ErrExceedTimeoutCount            = errors.New("exceed timeout count")
	ErrExceedTableAppendMessageCount = errors.New("exceed table append message count")
	ErrInvalidBlockFormat            = errors.New("invalid block format")
	ErrInvalidBlockHeaderFormat      = errors.New("invalid block header format")
)

block errors

Functions

This section is empty.

Types

type Block

type Block struct {
	Header *Header
	Body   *Body
}

Block includes a block header and a block body

func (*Block) MarshalJSON

func (b *Block) MarshalJSON() ([]byte, error)

MarshalJSON is a marshaler function

func (*Block) ReadFrom

func (b *Block) ReadFrom(r io.Reader) (int64, error)

ReadFrom is a deserialization function

func (*Block) WriteTo

func (b *Block) WriteTo(w io.Writer) (int64, error)

WriteTo is a serialization function

type Body

type Body struct {
	Transactions          []transaction.Transaction //MAXLEN : 65535
	TransactionSignatures [][]common.Signature      //MAXLEN : 65536
	Tran                  *data.Transactor
}

Body is the set of transactions with validation informations

func (*Body) MarshalJSON

func (bb *Body) MarshalJSON() ([]byte, error)

MarshalJSON is a marshaler function

func (*Body) ReadFrom

func (bb *Body) ReadFrom(r io.Reader) (int64, error)

ReadFrom is a deserialization function

func (*Body) WriteTo

func (bb *Body) WriteTo(w io.Writer) (int64, error)

WriteTo is a serialization function

type Header struct {
	chain.Base
	ChainCoord    common.Coordinate
	LevelRootHash hash.Hash256
	ContextHash   hash.Hash256
	Formulator    common.Address
	TimeoutCount  uint32
}

Header is validation informations

func (*Header) Hash

func (bh *Header) Hash() hash.Hash256

Hash returns the hash value of it

func (*Header) MarshalJSON

func (bh *Header) MarshalJSON() ([]byte, error)

MarshalJSON is a marshaler function

func (*Header) ReadFrom

func (bh *Header) ReadFrom(r io.Reader) (int64, error)

ReadFrom is a deserialization function

func (*Header) WriteTo

func (bh *Header) WriteTo(w io.Writer) (int64, error)

WriteTo is a serialization function

type ObserverSigned

type ObserverSigned struct {
	Signed
	ObserverSignatures []common.Signature //MAXLEN : 255
}

ObserverSigned is observer signatures and the generator signature of the block

func (*ObserverSigned) ReadFrom

func (s *ObserverSigned) ReadFrom(r io.Reader) (int64, error)

ReadFrom is a deserialization function

func (*ObserverSigned) WriteTo

func (s *ObserverSigned) WriteTo(w io.Writer) (int64, error)

WriteTo is a serialization function

type Signed

type Signed struct {
	HeaderHash         hash.Hash256
	GeneratorSignature common.Signature
}

Signed is the generator signature of the block

func (*Signed) Hash

func (s *Signed) Hash() hash.Hash256

Hash returns the hash value of it

func (*Signed) ReadFrom

func (s *Signed) ReadFrom(r io.Reader) (int64, error)

ReadFrom is a deserialization function

func (*Signed) WriteTo

func (s *Signed) WriteTo(w io.Writer) (int64, error)

WriteTo is a serialization function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL