types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DifficultyBoundDivisor = big.NewInt(2048)   // The bound divisor of the difficulty, used in the update calculations.
	GenesisDifficulty      = big.NewInt(131072) // Difficulty of the Genesis block.
	MinimumDifficulty      = big.NewInt(131072) // The minimum that the difficulty may ever be.
	DurationLimit          = big.NewInt(13)     // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
)

Some weird constants to avoid constant memory allocs for them.

View Source
var (
	ErrNotContiguous = errors.New("block not contiguous")
	ErrFutureBlock   = errors.New("block in the future")
	ErrInvalidBlock  = errors.New("invalid block")
)
View Source
var EncodeNonce = ethtypes.EncodeNonce

Functions

func CalcDifficulty

func CalcDifficulty(time uint64, parent *Header) *big.Int

Types

type Address

type Address = cmttypes.Address

func HexToAddress

func HexToAddress(s string) Address

type Block

type Block struct {
	Header   *Header `json:"header"`
	Txs      `json:"txs"`
	Uncles   Headers `json:"uncles"`
	Receipts `json:"receipts"`
}

func NewBlockWithHeader

func NewBlockWithHeader(header *Header) *Block

func (*Block) Hash

func (b *Block) Hash() Hash

Hash computes and returns the block hash. If the block is incomplete, block hash is nil for safety.

type BlockNonce

type BlockNonce = ethtypes.BlockNonce

type Hash

type Hash = cmtbytes.HexBytes
type Header struct {
	ParentHash  Hash       `json:"parentHash"       gencodec:"required"`
	UncleHash   Hash       `json:"sha3Uncles"       gencodec:"required"`
	Miner       Address    `json:"miner"            gencodec:"required"`
	Root        Hash       `json:"stateRoot"        gencodec:"required"`
	TxHash      Hash       `json:"transactionsRoot" gencodec:"required"`
	ReceiptHash Hash       `json:"receiptsRoot"     gencodec:"required"`
	Difficulty  *big.Int   `json:"difficulty"       gencodec:"required"`
	Height      *big.Int   `json:"height"           gencodec:"required"`
	Time        uint64     `json:"timestamp"        gencodec:"required"`
	Extra       HexBytes   `json:"extraData"        gencodec:"required"`
	Nonce       BlockNonce `json:"nonce"`
}

func CopyHeader

func CopyHeader(h *Header) *Header

func (*Header) Hash

func (h *Header) Hash() Hash

func (*Header) IsValid

func (h *Header) IsValid(parent *Header) error

type Headers

type Headers []*Header

func (Headers) Hash

func (rs Headers) Hash() []byte

type HexBytes

type HexBytes = cmtbytes.HexBytes

type Receipt

type Receipt struct {
	TxHash Hash     `json:"transactionHash"`
	Result HexBytes `json:"result"`
	Logs   HexBytes `json:"logs"`
}

func (*Receipt) Hash

func (r *Receipt) Hash() Hash

func (*Receipt) Success

func (r *Receipt) Success() bool

type Receipts

type Receipts []*Receipt

func (Receipts) Hash

func (rs Receipts) Hash() []byte

type StoredReceipt

type StoredReceipt struct {
	Receipt
	// Inclusion information: These fields provide information about the inclusion of the
	// transaction corresponding to this receipt.
	BlockHash        Hash     `json:"blockHash,omitempty"`
	BlockNumber      *big.Int `json:"blockNumber,omitempty"`
	TransactionIndex uint     `json:"transactionIndex"`
}

type Tx

type Tx = cmttypes.Tx // Just bytes

type TxHash

type TxHash = cmttypes.TxKey

type Txs

type Txs = cmttypes.Txs // Array of Tx

func TxDifference

func TxDifference(a, b Txs) (dropped, kept Txs)

TxDifference returns two sets which are dropped and kept from a compared to b.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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