ledger

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ledger

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

Ledger implements the core.Ledger interface

func NewLedger

func NewLedger(chainID string, db database.Database, chain *blockchain.Chain, consensus core.ConsensusEngine, valMgr core.ValidatorManager, mempool *mp.Mempool) *Ledger

NewLedger creates an instance of Ledger

func (*Ledger) ApplyBlockTxs

func (ledger *Ledger) ApplyBlockTxs(block *core.Block) result.Result

ApplyBlockTxs applies the given block transactions. If any of the transactions failed, it returns an error immediately. If all the transactions execute successfully, it then validates the state root hash. If the states root hash matches the expected value, it clears the transactions from the mempool

func (*Ledger) ApplyBlockTxsForChainCorrection added in v1.0.5

func (ledger *Ledger) ApplyBlockTxsForChainCorrection(block *core.Block) (common.Hash, result.Result)

ApplyBlockTxsForChainCorrection applies all block's txs and re-calculate root hash

func (*Ledger) FinalizeState

func (ledger *Ledger) FinalizeState(height uint64, rootHash common.Hash) result.Result

FinalizeState sets the ledger state with the finalized root

func (*Ledger) GetCurrentBlock

func (ledger *Ledger) GetCurrentBlock() *core.Block

GetCurrentBlock returns the block currently being processed

func (*Ledger) GetDeliveredSnapshot

func (ledger *Ledger) GetDeliveredSnapshot() (*st.StoreView, error)

GetDeliveredSnapshot returns a snapshot of delivered ledger state to query about accounts, etc.

func (*Ledger) GetFinalizedSnapshot

func (ledger *Ledger) GetFinalizedSnapshot() (*st.StoreView, error)

GetFinalizedSnapshot returns a snapshot of finalized ledger state to query about accounts, etc.

func (*Ledger) GetFinalizedValidatorCandidatePool

func (ledger *Ledger) GetFinalizedValidatorCandidatePool(blockHash common.Hash, isNext bool) (*core.ValidatorCandidatePool, error)

GetFinalizedValidatorCandidatePool returns the validator candidate pool of the latest DIRECTLY finalized block

func (*Ledger) GetScreenedSnapshot

func (ledger *Ledger) GetScreenedSnapshot() (*st.StoreView, error)

GetScreenedSnapshot returns a snapshot of screened ledger state to query about accounts, etc.

func (*Ledger) ProposeBlockTxs

func (ledger *Ledger) ProposeBlockTxs(block *core.Block) (stateRootHash common.Hash, blockRawTxs []common.Bytes, res result.Result)

ProposeBlockTxs collects and executes a list of transactions, which will be used to assemble the next blockl It also clears these transactions from the mempool.

func (*Ledger) PruneState

func (ledger *Ledger) PruneState(targetEndHeight uint64) error

PruneState attempts to prune the state up to the targetEndHeight

func (*Ledger) ResetState

func (ledger *Ledger) ResetState(height uint64, rootHash common.Hash) result.Result

ResetState sets the ledger state with the designated root

func (*Ledger) ScreenTx

func (ledger *Ledger) ScreenTx(rawTx common.Bytes) (txInfo *core.TxInfo, res result.Result)

ScreenTx screens the given transaction

func (*Ledger) ScreenTxUnsafe

func (ledger *Ledger) ScreenTxUnsafe(rawTx common.Bytes) (res result.Result)

ScreenTxUnsafe screens the given transaction without locking.

func (*Ledger) State

func (ledger *Ledger) State() *st.LedgerState

State returns the state of the ledger

Directories

Path Synopsis
vm
Package vm implements the Ethereum Virtual Machine.
Package vm implements the Ethereum Virtual Machine.
asm
Provides support for dealing with EVM assembly instructions (e.g., disassembling them).
Provides support for dealing with EVM assembly instructions (e.g., disassembling them).
runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.

Jump to

Keyboard shortcuts

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