chainconf

package module
v0.0.0-...-5a42ec4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: Apache-2.0 Imports: 22 Imported by: 7

README

chainconf

介绍

hercules 链配置模块

软件架构

软件架构说明

安装教程
  1. xxxx
  2. xxxx
  3. xxxx
使用说明
  1. xxxx
  2. xxxx
  3. xxxx
参与贡献
  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/

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.

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 judeg whether is a native transaction

func RegisterVerifier

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

RegisterVerifier register a verifier.

Types

type ChainConf

type ChainConf struct {
	ChainConf *config.ChainConfig // chain config
	// 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.

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.

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.

type Option

type Option func(f *options) error

Option is a 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