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: 0

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