Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IncomingMessageToBlock ¶
func IncomingMessageToBlock(vmDb vm_db.VmDb, im *header.IncomingMessage) (*ledger.AccountBlock, error)
IncomingMessageToBlock returns a complete block by a IncomingMessage.
func NewGenerator ¶
func NewGenerator(chain vm_db.Chain, consensus Consensus, addr types.Address, latestSnapshotBlockHash, prevBlockHash *types.Hash) (header.Generator, error)
NewGenerator needs to new a vm_db.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 IncomingMessage ¶
type IncomingMessage struct { BlockType byte AccountAddress types.Address ToAddress *types.Address FromBlockHash *types.Hash TokenId *types.TokenTypeId Amount *big.Int Fee *big.Int Data []byte Difficulty *big.Int }
IncomingMessage carries the necessary transaction info.
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.