utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyValidors    = errors.New("Current validators is empty.")
	NotValidContract = errors.New("Cannot get valid res with contract.")
	EmptyJustify     = errors.New("Justify is empty.")
	InvalidJustify   = errors.New("Justify structure is invalid.")

	MaxMapSize = 1000

	StatusOK         = 200
	StatusBadRequest = 400
	StatusErr        = 500
)

Functions

func AddressEqual

func AddressEqual(a []string, b []string) bool

AddressEqual 判断两个validators地址是否相等

func CleanProduceMap

func CleanProduceMap(isProduce map[int64]bool, period int64)

func InitQCTree

func InitQCTree(startHeight int64, ledger cctx.LedgerRely, log logs.Logger) *chainedBft.QCPendingTree

initQCTree 创建了smr需要的QC树存储,该Tree存储了目前待commit的QC信息

func NewContractErrResponse

func NewContractErrResponse(status int, msg string) *contract.Response

func NewContractOKResponse

func NewContractOKResponse(json []byte) *contract.Response

func NewSignToOld

func NewSignToOld(new []*bftPb.QuorumCertSign) []*lpb.SignInfo

NewSignToOld 新的签名结构转化为老的签名结构

func NewToOldQC

func NewToOldQC(new *chainedBft.QuorumCert) (*lpb.QuorumCert, error)

NewToOldQC 为新的QC pb结构转化为老pb结构

func OldQCToNew

func OldQCToNew(storage []byte) (*chainedBft.QuorumCert, error)

OldQCToNew 为老的QC pb结构转化为新的QC结构

func OldSignToNew

func OldSignToNew(storage []byte) []*bftPb.QuorumCertSign

OldSignToNew 老的签名结构转化为新的签名结构

Types

type ConsensusStorage

type ConsensusStorage struct {
	Justify     *lpb.QuorumCert `json:"justify,omitempty"`
	CurTerm     int64           `json:"curTerm,omitempty"`
	CurBlockNum int64           `json:"curBlockNum,omitempty"`
	// TargetBits 是一个trick实现
	// 1. 在bcs层作为一个复用字段,记录ChainedBFT发生回滚时,当前的TipHeight,此处用int32代替int64,理论上可能造成错误
	TargetBits int32 `json:"targetBits,omitempty"`
}

/////////////////// lpb兼容逻辑 ///////////////////// 历史共识存储字段

func ParseOldQCStorage

func ParseOldQCStorage(storage []byte) (*ConsensusStorage, error)

ParseOldQCStorage 将有Justify结构的老共识结构解析出来

Jump to

Keyboard shortcuts

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