validation

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxVersion                 = errors.New("invalid transaction version")
	ErrWrongTransactionSize      = errors.New("invalid transaction size")
	ErrBadTimeRange              = errors.New("invalid transaction time range")
	ErrEmptyInputIDs             = errors.New("got the empty InputIDs")
	ErrNotStandardTx             = errors.New("not standard transaction")
	ErrWrongCoinbaseTransaction  = errors.New("wrong coinbase transaction")
	ErrWrongCoinbaseAsset        = errors.New("wrong coinbase assetID")
	ErrCoinbaseArbitraryOversize = errors.New("coinbase arbitrary size is larger than limit")
	ErrEmptyResults              = errors.New("transaction has no results")
	ErrMismatchedAssetID         = errors.New("mismatched assetID")
	ErrMismatchedPosition        = errors.New("mismatched value source/dest position")
	ErrMismatchedReference       = errors.New("mismatched reference")
	ErrMismatchedValue           = errors.New("mismatched value")
	ErrMissingField              = errors.New("missing required field")
	ErrNoSource                  = errors.New("no source for value")
	ErrOverflow                  = errors.New("arithmetic overflow/underflow")
	ErrPosition                  = errors.New("invalid source or destination position")
	ErrUnbalanced                = errors.New("unbalanced asset amount between input and output")
	ErrOverGasCredit             = errors.New("all gas credit has been spend")
	ErrGasCalculate              = errors.New("gas usage calculate got a math error")
)

validate transaction error

Functions

func NewTxVMContext

func NewTxVMContext(vs *validationState, entry bc.Entry, prog *bc.Program, args [][]byte) *vm.Context

NewTxVMContext generates the vm.Context for BVM

func ValidateBlock

func ValidateBlock(b *bc.Block, parent *state.BlockNode) error

ValidateBlock validates a block and the transactions within.

func ValidateBlockHeader added in v0.4.6

func ValidateBlockHeader(b *bc.Block, parent *state.BlockNode) error

ValidateBlockHeader check the block's header

Types

type GasState added in v0.4.1

type GasState struct {
	BTMValue   uint64
	GasLeft    int64
	GasUsed    int64
	GasValid   bool
	StorageGas int64
}

GasState record the gas usage status

func ValidateTx

func ValidateTx(tx *bc.Tx, block *bc.Block) (*GasState, error)

ValidateTx validates a transaction.

type ValidateTxResult added in v1.1.0

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

ValidateTxResult is the result of async tx validate

func ValidateTxs added in v1.1.0

func ValidateTxs(txs []*bc.Tx, block *bc.Block) []*ValidateTxResult

ValidateTxs validates txs in async mode

func (*ValidateTxResult) GetError added in v1.1.0

func (r *ValidateTxResult) GetError() error

GetError return the err

func (*ValidateTxResult) GetGasState added in v1.1.0

func (r *ValidateTxResult) GetGasState() *GasState

GetGasState return the gasStatus

Jump to

Keyboard shortcuts

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