Documentation
¶
Index ¶
- Variables
- type BasicCheckError
- type Block
- func (b *Block) BasicCheck() error
- func (b *Block) Bytes() ([]byte, error)
- func (b *Block) Decode(r io.Reader) error
- func (b *Block) Encode(w io.Writer) error
- func (b *Block) Hash() hash.Hash
- func (b *Block) Header() *Header
- func (b *Block) Height() uint32
- func (b *Block) LogString() string
- func (b *Block) MarshalCBOR() ([]byte, error)
- func (b *Block) PrevCertificate() *certificate.Certificate
- func (b *Block) SerializeSize() int
- func (b *Block) Transactions() Txs
- func (b *Block) UnmarshalCBOR(bs []byte) error
- type Header
- func (h *Header) BasicCheck() error
- func (h *Header) Decode(r io.Reader) error
- func (h *Header) Encode(w io.Writer) error
- func (h *Header) PrevBlockHash() hash.Hash
- func (h *Header) ProposerAddress() crypto.Address
- func (*Header) SerializeSize() int
- func (h *Header) SortitionSeed() sortition.VerifiableSeed
- func (h *Header) StateRoot() hash.Hash
- func (h *Header) Time() time.Time
- func (h *Header) UnixTime() uint32
- func (h *Header) Version() protocol.Version
- type Height
- type Txs
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyTransactions = errors.New("too many transactions in block")
Functions ¶
This section is empty.
Types ¶
type BasicCheckError ¶ added in v0.15.0
type BasicCheckError struct {
Reason string
}
BasicCheckError is returned when the basic check on the certificate fails.
func (BasicCheckError) Error ¶ added in v0.15.0
func (e BasicCheckError) Error() string
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
func FromString ¶ added in v1.11.0
FromString constructs a new block from a hex-encoded string.
func MakeBlock ¶
func MakeBlock(version protocol.Version, timestamp time.Time, txs Txs, prevBlockHash, stateRoot hash.Hash, prevCert *certificate.Certificate, sortitionSeed sortition.VerifiableSeed, proposer crypto.Address, ) *Block
func NewBlock ¶
func NewBlock(header *Header, prevCert *certificate.Certificate, txs Txs) *Block
func (*Block) BasicCheck ¶ added in v0.15.0
BasicCheck performs basic validation checks on the block structure and its contents.
func (*Block) Bytes ¶
Bytes returns the serialized bytes for the Block. It caches the result so subsequent calls are more efficient.
func (*Block) Hash ¶
Hash returns the hash of the block. The hash is memorized after the first calculation.
func (*Block) Height ¶ added in v1.4.0
Height returns the height of the block. TODO: return block.Height type.
func (*Block) LogString ¶ added in v1.11.0
LogString returns a concise string representation intended for use in logs.
func (*Block) MarshalCBOR ¶
func (*Block) PrevCertificate ¶
func (b *Block) PrevCertificate() *certificate.Certificate
func (*Block) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the block.
func (*Block) Transactions ¶
func (*Block) UnmarshalCBOR ¶
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func (*Header) BasicCheck ¶ added in v0.15.0
func (*Header) PrevBlockHash ¶
PrevBlockHash returns the previous block hash.
func (*Header) ProposerAddress ¶
ProposerAddress returns the proposer address.
func (*Header) SerializeSize ¶
SerializeSize returns the number of bytes it would take to serialize the header.
func (*Header) SortitionSeed ¶
func (h *Header) SortitionSeed() sortition.VerifiableSeed
SortitionSeed returns the sortition seed.