world_state

package
v0.0.0-...-8cfcfd0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 10 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

This section is empty.

Functions

This section is empty.

Types

type WroldState

type WroldState struct {
	BlockNum     uint64            `json:"blockNum"`  // 当前区块编号
	PrevBlock    string            `json:"prevBlock"` // 前一个区块hash
	BlockID      string            `json:"blockID"`   // 当前区块hash
	Verifiers    []*model.Verifier `json:"verifiers"` // 当前所有的验证者
	VerifiersMap map[string]struct{}
	VerifierNo   int             `josn:"verifierNo"` // 验证者所处编号 如果为-1  表示不是验证者
	CurVerfier   *model.Verifier `json:"curVerfier"`
	View         uint64          `json:"view"` // 当前视图

	sync.RWMutex `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(dbCache *cache.DBCache, txRecordPath string) *WroldState

func (*WroldState) GetBlock

func (ws *WroldState) GetBlock(key interface{}) (*model.PbftBlock, error)

func (*WroldState) GetBlockMeta

func (ws *WroldState) GetBlockMeta() (*model.BlockMeta, error)

func (*WroldState) GetGenesis

func (ws *WroldState) GetGenesis() (*model.Genesis, error)

func (*WroldState) IncreaseBlockNum

func (ws *WroldState) IncreaseBlockNum()

func (*WroldState) IncreaseView

func (ws *WroldState) IncreaseView()

func (*WroldState) InsertBlock

func (ws *WroldState) InsertBlock(block *model.PbftBlock) error

func (*WroldState) InsertTxRecords

func (ws *WroldState) InsertTxRecords(txs []*model.Tx, txrs []*model.TxReceipt, blockNum int64) error

func (*WroldState) IsVerfier

func (ws *WroldState) IsVerfier(publicKey []byte) bool

func (*WroldState) SetBlockNum

func (ws *WroldState) SetBlockNum(num uint64)

func (*WroldState) SetGenesis

func (ws *WroldState) SetGenesis(g *model.Genesis) error

func (*WroldState) SetValue

func (ws *WroldState) SetValue(blockNum uint64, prevBlock string, blockID string,
	verifiers []*model.Verifier)

func (*WroldState) SetView

func (ws *WroldState) SetView(v uint64)

func (*WroldState) StartAPI

func (ws *WroldState) StartAPI(g *echo.Group)

func (*WroldState) UpdateLastWorldState

func (ws *WroldState) UpdateLastWorldState() error

Jump to

Keyboard shortcuts

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