Documentation ¶
Overview ¶
Package chainconf record all the values of the chain config options.
Index ¶
- func Genesis(genesisFile string) (*config.ChainConfig, error)
- func GetVerifier(chainId string, consensusType consensus.ConsensusType) protocol.Verifier
- func HandleCompatibility(chainConfig *config.ChainConfig) error
- func IsNativeTxSucc(tx *common.Transaction) (contract string, b bool)
- func RegisterVerifier(chainId string, consensusType consensus.ConsensusType, ...) error
- type ChainConf
- func (c *ChainConf) AddVmWatch(w protocol.VmWatcher)
- func (c *ChainConf) AddWatch(w protocol.Watcher)
- func (f *ChainConf) Apply(opts ...Option) error
- func (c *ChainConf) ChainConfig() *config.ChainConfig
- func (c *ChainConf) CompleteBlock(block *common.Block) error
- func (c *ChainConf) GetChainConfigAt(blockHeight uint64) (*config.ChainConfig, error)
- func (c *ChainConf) GetChainConfigFromFuture(futureBlockHeight uint64) (*config.ChainConfig, error)
- func (c *ChainConf) GetConsensusNodeIdList() ([]string, error)
- func (c *ChainConf) Init() error
- func (c *ChainConf) SetChainConfig(chainConf *config.ChainConfig) error
- type ChainConfig
- type Option
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 ¶
NewChainConf create a new ChainConf instance.
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) ChainConfig ¶
func (c *ChainConf) ChainConfig() *config.ChainConfig
ChainConfig return the chain config.
func (*ChainConf) CompleteBlock ¶
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 ¶
GetConsensusNodeIdList return the node id list of all consensus node.
func (*ChainConf) SetChainConfig ¶ added in v2.3.1
func (c *ChainConf) SetChainConfig(chainConf *config.ChainConfig) error
SetChainConfig set safe chain config
type ChainConfig ¶
type ChainConfig struct { *config.ChainConfig NodeOrgIds map[string][]string // NodeOrgIds is a map mapped org with consensus nodes ids. NodeIds map[string]string // NodeIds is a map mapped node id with org. CaRoots map[string]struct{} // CaRoots is a map stored org ids. ResourcePolicies map[string]struct{} // ResourcePolicies is a map stored resource. }
ChainConfig ChainConfig struct
func VerifyChainConfig ¶
func VerifyChainConfig(cconfig *config.ChainConfig) (*ChainConfig, error)
VerifyChainConfig verify the chain config.