Documentation ¶
Index ¶
- Constants
- func ApplyTx(virtualMachine vm.VM, tx *types.Transaction) ([]byte, uint64, bool, error)
- func NewVM(config *common.Config, tx *types.Transaction, header *types.Header, ...) vm.VM
- type BlockValidator
- type BlockValidatorImpl
- func (v *BlockValidatorImpl) ValidateBody(block *types.Block) error
- func (v *BlockValidatorImpl) ValidateHeader(header *types.Header) error
- func (v *BlockValidatorImpl) ValidateHeaders(headers []*types.Header) (chan struct{}, chan error)
- func (v *BlockValidatorImpl) ValidateState(block *types.Block, state *state.StateDB, receipts types.Receipts) error
- type Config
- type Executor
- type GasPool
- type Processor
- type StateTransition
- type TxValidator
- type TxValidatorImpl
Constants ¶
const ( EVM vmType = iota EWASM JSVM )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockValidator ¶
type BlockValidatorImpl ¶
type BlockValidatorImpl struct {
// contains filtered or unexported fields
}
func NewBlockValidator ¶
func NewBlockValidator(config *common.Config, chain chain.Blockchain) *BlockValidatorImpl
func (*BlockValidatorImpl) ValidateBody ¶
func (v *BlockValidatorImpl) ValidateBody(block *types.Block) error
Validate block body 1. Check block already exist in db or not 1. Check transactions match tx root in header or not
func (*BlockValidatorImpl) ValidateHeader ¶
func (v *BlockValidatorImpl) ValidateHeader(header *types.Header) error
ValidateHeader validate headers, called by outer obj 1. check header already exist or not 2. check parent exist or not 3. check detail header info
func (*BlockValidatorImpl) ValidateHeaders ¶
func (v *BlockValidatorImpl) ValidateHeaders(headers []*types.Header) (chan struct{}, chan error)
ValidateHeaders validate headers in batch, used by sync-chain processing. It returns two channels, one is to abort the validate process, and the other is to store errors。
func (*BlockValidatorImpl) ValidateState ¶
func (v *BlockValidatorImpl) ValidateState(block *types.Block, state *state.StateDB, receipts types.Receipts) error
Validate block txs 1. Validate receipts root hash 2. Validate Bloom filter 3. Validate state root
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
type GasPool ¶
type GasPool uint64
GasPool tracks the amount of gas available during execution of the transactions in a block. The zero value is a pool with zero gas available.
type StateTransition ¶
type StateTransition struct {
// contains filtered or unexported fields
}
func NewStateTransition ¶
func NewStateTransition(virtualMachine vm.VM, tx *types.Transaction) *StateTransition
type TxValidator ¶
type TxValidator interface { ValidateTxs(types.Transactions) (types.Transactions, types.Transactions) ValidateTx(*types.Transaction) error }
type TxValidatorImpl ¶
type TxValidatorImpl struct {
// contains filtered or unexported fields
}
func NewTxValidator ¶
func NewTxValidator(config *common.Config, state *state.StateDB) *TxValidatorImpl
func (*TxValidatorImpl) ValidateTx ¶
func (v *TxValidatorImpl) ValidateTx(tx *types.Transaction) error
Validate transaction 1. check tx size 2. check tx value 3. check address is match 4. check signature is match 5. check nonce 6. check balance is enough or not for tx.Cost()
func (*TxValidatorImpl) ValidateTxs ¶
func (v *TxValidatorImpl) ValidateTxs(txs types.Transactions) (valid types.Transactions, invalid types.Transactions)