chainconf

package module
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 22 Imported by: 7

Documentation

Overview

Package chainconf record all the values of the chain config options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Genesis

func Genesis(genesisFile string) (*config.ChainConfig, error)

Genesis will create new genesis config block of chain. 根据bc1.yml配置文件生成ChainConfig配置对象 如果配置文件有错误,则直接返回错误

func GetVerifier

func GetVerifier(chainId string, consensusType consensus.ConsensusType) protocol.Verifier

GetVerifier get a verifier if exist.

func HandleCompatibility

func HandleCompatibility(chainConfig *config.ChainConfig) error

HandleCompatibility will make new version to be compatible with old version

func IsNativeTxSucc

func IsNativeTxSucc(tx *common.Transaction) (contract string, b bool)

IsNativeTxSucc whether the transaction is a native and run success

func RegisterVerifier

func RegisterVerifier(chainId string, consensusType consensus.ConsensusType, verifier protocol.Verifier) error

RegisterVerifier register a verifier.

Types

type ChainConf

type ChainConf struct {

	// chain config
	ChainConf *config.ChainConfig
	// contains filtered or unexported fields
}

ChainConf is the config of a chain.

func NewChainConf

func NewChainConf(opts ...Option) (*ChainConf, error)

NewChainConf create a new ChainConf instance. @param opts @return *ChainConf @return error

func (*ChainConf) AddVmWatch

func (c *ChainConf) AddVmWatch(w protocol.VmWatcher)

AddVmWatch add vm watcher

func (*ChainConf) AddWatch

func (c *ChainConf) AddWatch(w protocol.Watcher)

AddWatch register a config watcher.

func (*ChainConf) Apply

func (f *ChainConf) Apply(opts ...Option) error

Apply all options.

func (*ChainConf) ChainConfig

func (c *ChainConf) ChainConfig() *config.ChainConfig

ChainConfig return the chain config.

func (*ChainConf) CompleteBlock

func (c *ChainConf) CompleteBlock(block *common.Block) error

CompleteBlock complete the block. Invoke all config watchers.

func (*ChainConf) GetChainConfigAt

func (c *ChainConf) GetChainConfigAt(blockHeight uint64) (*config.ChainConfig, error)

GetChainConfigAt get the lasted block info of chain config. The blockHeight must exist in store. If it is a config block , return the current config info.

func (*ChainConf) GetChainConfigFromFuture

func (c *ChainConf) GetChainConfigFromFuture(futureBlockHeight uint64) (*config.ChainConfig, error)

GetChainConfigFromFuture get a future chain config.

func (*ChainConf) GetConsensusNodeIdList

func (c *ChainConf) GetConsensusNodeIdList() ([]string, error)

GetConsensusNodeIdList return the node id list of all consensus node.

func (*ChainConf) Init

func (c *ChainConf) Init() error

Init chain config.

func (*ChainConf) SetChainConfig

func (c *ChainConf) SetChainConfig(chainConf *config.ChainConfig) error

SetChainConfig set safe chain config

type ChainConfig

type ChainConfig struct {
	*config.ChainConfig
	// NodeOrgIds is a map mapped org with consensus nodes ids.
	NodeOrgIds map[string][]string
	// NodeIds is a map mapped node id with org.
	NodeIds map[string]string
	// CaRoots is a map stored org ids.
	CaRoots map[string]struct{}
	// ResourcePolicies is a map stored resource.
	ResourcePolicies map[string]struct{}
}

ChainConfig ChainConfig struct

func VerifyChainConfig

func VerifyChainConfig(cconfig *config.ChainConfig) (*ChainConfig, error)

VerifyChainConfig verify the chain config.

type Option

type Option func(f *options) error

Option is an option for chain config.

func WithBlockchainStore

func WithBlockchainStore(blockchainStore protocol.BlockchainStore) Option

WithBlockchainStore set the block chain store.

func WithChainId

func WithChainId(chainId string) Option

WithChainId set the chain id.

func WithMsgBus

func WithMsgBus(msgBus msgbus.MessageBus) Option

WithMsgBus bind a msg-bus.

Jump to

Keyboard shortcuts

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