blocks

package
v1.9.9-rc.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CodecVersion = txs.CodecVersion

CodecVersion is the current default codec version

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	snow.ContextInitializable

	ID() ids.ID
	Parent() ids.ID
	Height() uint64
	// Timestamp that this block was created at
	Timestamp() time.Time
	Bytes() []byte

	// Txs returns the transactions contained in the block
	Txs() []*txs.Tx
	// contains filtered or unexported methods
}

Block defines the common stateless interface for all blocks

type Parser

type Parser interface {
	txs.Parser

	ParseBlock(bytes []byte) (Block, error)
	ParseGenesisBlock(bytes []byte) (Block, error)

	InitializeBlock(block Block) error
	InitializeGenesisBlock(block Block) error
}

func NewCustomParser added in v1.9.8

func NewCustomParser(
	typeToFxIndex map[reflect.Type]int,
	clock *mockable.Clock,
	log logging.Logger,
	fxs []fxs.Fx,
) (Parser, error)

func NewParser

func NewParser(fxs []fxs.Fx) (Parser, error)

type StandardBlock

type StandardBlock struct {
	// parent's ID
	PrntID ids.ID `serialize:"true" json:"parentID"`
	// This block's height. The genesis block is at height 0.
	Hght uint64 `serialize:"true" json:"height"`
	Time uint64 `serialize:"true" json:"time"`
	// List of transactions contained in this block.
	Transactions []*txs.Tx `serialize:"true" json:"txs"`
	// contains filtered or unexported fields
}

func NewStandardBlock

func NewStandardBlock(
	parentID ids.ID,
	height uint64,
	timestamp time.Time,
	txs []*txs.Tx,
	cm codec.Manager,
) (*StandardBlock, error)

func (*StandardBlock) Bytes

func (b *StandardBlock) Bytes() []byte

func (*StandardBlock) Height

func (b *StandardBlock) Height() uint64

func (*StandardBlock) ID

func (b *StandardBlock) ID() ids.ID

func (*StandardBlock) InitCtx

func (b *StandardBlock) InitCtx(ctx *snow.Context)

func (*StandardBlock) Parent

func (b *StandardBlock) Parent() ids.ID

func (*StandardBlock) Timestamp

func (b *StandardBlock) Timestamp() time.Time

func (*StandardBlock) Txs

func (b *StandardBlock) Txs() []*txs.Tx

Jump to

Keyboard shortcuts

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