generator

package
v2.11.3-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IncomingMessageToBlock

func IncomingMessageToBlock(vmDb interfaces.VmDb, im *interfaces.IncomingMessage) (*ledger.AccountBlock, error)

IncomingMessageToBlock returns a complete block by a IncomingMessage.

func NewGenerator

func NewGenerator(chain vm_db.Chain, sbpStatReader core.SBPStatReader, addr types.Address, latestSnapshotBlockHash, prevBlockHash *types.Hash) (interfaces.Generator, error)

NewGenerator needs to new a interfaces.VmDb with state of the world and SBP information for Vm,

the third "addr" needs to be filled with the address of the account chain to be blocked, and the last needs to be filled with the previous/latest block's hash on the account chain.

Types

type Consensus

type Consensus interface {
	SBPReader() core.SBPStatReader
}

Consensus is for Vm to read the SBP information

type EnvPrepareForGenerator

type EnvPrepareForGenerator struct {
	LatestSnapshotHash   *types.Hash
	LatestSnapshotHeight uint64
	LatestAccountHash    *types.Hash
	LatestAccountHeight  uint64
}

EnvPrepareForGenerator carries the info about the latest state of the world.

func GetAddressStateForGenerator

func GetAddressStateForGenerator(chain stateChain, addr *types.Address) (*EnvPrepareForGenerator, error)

GetAddressStateForGenerator returns the latest state of the world including the account's and snapshot's.

type VMGlobalStatus

type VMGlobalStatus struct {
	// contains filtered or unexported fields
}

VMGlobalStatus provides data about random seed.

func NewVMGlobalStatus

func NewVMGlobalStatus(c chain, sb *ledger.SnapshotBlock, fromHash types.Hash) *VMGlobalStatus

NewVMGlobalStatus needs method to get the seed from the snapshot block.

func (*VMGlobalStatus) Random

func (g *VMGlobalStatus) Random() (uint64, error)

Random returns a new random number

func (*VMGlobalStatus) Seed

func (g *VMGlobalStatus) Seed() (uint64, error)

Seed returns the random seed.

func (*VMGlobalStatus) SnapshotBlock

func (g *VMGlobalStatus) SnapshotBlock() *ledger.SnapshotBlock

SnapshotBlock returns the SnapshotBlock to which the seed referred.

Jump to

Keyboard shortcuts

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