core

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIProcessor

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

func (*APIProcessor) Process

func (p *APIProcessor) Process(tx *tx.Tx) error

type BlockChain

type BlockChain struct {
	*sdb.ChainDB
	Statedb *sdb.StateDB // Cache for current block changes.
	// contains filtered or unexported fields
}

func NewBlockChain

func NewBlockChain(config *ChainConfig, moduleName string) (*BlockChain, error)

func NewBlockChainForDryRun

func NewBlockChainForDryRun(accountModel account.AccountModel,
	nftModel nft.L2NftModel, txPoolModel tx.TxPoolModel, assetModel asset.AssetModel,
	sysConfigModel sysconfig.SysConfigModel, redisCache dbcache.Cache) (*BlockChain, error)

NewBlockChainForDryRun - for dry run mode, we can reuse existing models for quick creation , e.g., for sending tx, we can create blockchain for each request quickly

func (*BlockChain) ApplyTransaction

func (bc *BlockChain) ApplyTransaction(tx *tx.Tx) error

func (*BlockChain) CommitNewBlock

func (bc *BlockChain) CommitNewBlock(blockSize int, createdAt int64) (*block.BlockStates, error)

func (*BlockChain) CurrentBlock

func (bc *BlockChain) CurrentBlock() *block.Block

func (*BlockChain) DB

func (bc *BlockChain) DB() *sdb.ChainDB

func (*BlockChain) InitNewBlock added in v0.0.5

func (bc *BlockChain) InitNewBlock() (*block.Block, error)

func (*BlockChain) StateDB

func (bc *BlockChain) StateDB() *sdb.StateDB

func (*BlockChain) VerifyExpiredAt

func (bc *BlockChain) VerifyExpiredAt(expiredAt int64) error

func (*BlockChain) VerifyGas

func (bc *BlockChain) VerifyGas(gasAccountIndex, gasFeeAssetId int64, txType int, gasFeeAmount *big.Int, skipGasAmtChk bool) error

func (*BlockChain) VerifyNonce

func (bc *BlockChain) VerifyNonce(accountIndex int64, nonce int64) error

type ChainConfig

type ChainConfig struct {
	Postgres struct {
		DataSource string
	}
	CacheRedis cache.CacheConf
	//nolint:staticcheck
	CacheConfig statedb.CacheConfig `json:",optional"`
	TreeDB      struct {
		Driver tree.Driver
		//nolint:staticcheck
		LevelDBOption tree.LevelDBOption `json:",optional"`
		//nolint:staticcheck
		RedisDBOption tree.RedisDBOption `json:",optional"`
		//nolint:staticcheck
		RoutinePoolSize    int `json:",optional"`
		AssetTreeCacheSize int
	}
}

type CommitProcessor

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

func (*CommitProcessor) Process

func (p *CommitProcessor) Process(tx *tx.Tx) error

type Processor

type Processor interface {
	Process(tx *tx.Tx) error
}

func NewAPIProcessor

func NewAPIProcessor(bc *BlockChain) Processor

func NewCommitProcessor

func NewCommitProcessor(bc *BlockChain) Processor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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