state

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Facade

type Facade interface {
	GenesisHash() hash.Hash
	LastBlockHeight() uint32
	LastBlockHash() hash.Hash
	LastBlockTime() time.Time
	LastCertificate() *block.Certificate
	BlockTime() time.Duration
	UpdateLastCertificate(lastCertificate *block.Certificate) error
	ProposeBlock(consSigner crypto.Signer, rewardAddr crypto.Address, round int16) (*block.Block, error)
	ValidateBlock(block *block.Block) error
	CommitBlock(height uint32, block *block.Block, cert *block.Certificate) error
	CommitteeValidators() []*validator.Validator
	IsInCommittee(addr crypto.Address) bool
	Proposer(round int16) *validator.Validator
	IsProposer(addr crypto.Address, round int16) bool
	IsValidator(addr crypto.Address) bool
	TotalPower() int64
	TotalAccounts() int32
	TotalValidators() int32
	CommitteePower() int64
	PendingTx(id tx.ID) *tx.Tx
	AddPendingTx(trx *tx.Tx) error
	AddPendingTxAndBroadcast(trx *tx.Tx) error
	StoredBlock(height uint32) *store.StoredBlock
	StoredTx(id tx.ID) *store.StoredTx
	BlockHash(height uint32) hash.Hash
	BlockHeight(hash hash.Hash) uint32
	AccountByAddress(addr crypto.Address) *account.Account
	ValidatorByAddress(addr crypto.Address) *validator.Validator
	ValidatorByNumber(number int32) *validator.Validator
	Params() param.Params
	Close() error
	Fingerprint() string
}

func LoadOrNewState

func LoadOrNewState(
	genDoc *genesis.Genesis,
	signers []crypto.Signer,
	store store.Store,
	txPool txpool.TxPool, eventCh chan event.Event) (Facade, error)

type MockState

type MockState struct {
	TestGenHash   hash.Hash
	TestStore     *store.MockStore
	TestPool      *txpool.MockTxPool
	TestCommittee committee.Committee
	TestParams    param.Params
	// contains filtered or unexported fields
}

func MockingState

func MockingState() *MockState

func (*MockState) AccountByAddress

func (m *MockState) AccountByAddress(addr crypto.Address) *account.Account

func (*MockState) AddPendingTx

func (m *MockState) AddPendingTx(trx *tx.Tx) error

func (*MockState) AddPendingTxAndBroadcast

func (m *MockState) AddPendingTxAndBroadcast(trx *tx.Tx) error

func (*MockState) BlockHash

func (m *MockState) BlockHash(height uint32) hash.Hash

func (*MockState) BlockHeight

func (m *MockState) BlockHeight(hash hash.Hash) uint32

func (*MockState) BlockTime

func (m *MockState) BlockTime() time.Duration

func (*MockState) Close

func (m *MockState) Close() error

func (*MockState) CommitBlock

func (m *MockState) CommitBlock(h uint32, b *block.Block, cert *block.Certificate) error

func (*MockState) CommitTestBlocks

func (m *MockState) CommitTestBlocks(num int)

func (*MockState) CommitteePower

func (m *MockState) CommitteePower() int64

func (*MockState) CommitteeValidators

func (m *MockState) CommitteeValidators() []*validator.Validator

func (*MockState) Fingerprint

func (m *MockState) Fingerprint() string

func (*MockState) GenesisHash

func (m *MockState) GenesisHash() hash.Hash

func (*MockState) IsInCommittee

func (m *MockState) IsInCommittee(addr crypto.Address) bool

func (*MockState) IsProposer

func (m *MockState) IsProposer(addr crypto.Address, round int16) bool

func (*MockState) IsValidator

func (m *MockState) IsValidator(addr crypto.Address) bool

func (*MockState) LastBlockHash

func (m *MockState) LastBlockHash() hash.Hash

func (*MockState) LastBlockHeight

func (m *MockState) LastBlockHeight() uint32

func (*MockState) LastBlockTime

func (m *MockState) LastBlockTime() time.Time

func (*MockState) LastCertificate

func (m *MockState) LastCertificate() *block.Certificate

func (*MockState) Params

func (m *MockState) Params() param.Params

func (*MockState) PendingTx

func (m *MockState) PendingTx(id tx.ID) *tx.Tx

func (*MockState) ProposeBlock

func (m *MockState) ProposeBlock(_ crypto.Signer, _ crypto.Address, _ int16) (*block.Block, error)

func (*MockState) Proposer

func (m *MockState) Proposer(round int16) *validator.Validator

func (*MockState) StoredBlock

func (m *MockState) StoredBlock(height uint32) *store.StoredBlock

func (*MockState) StoredTx

func (m *MockState) StoredTx(id tx.ID) *store.StoredTx

func (*MockState) TotalAccounts added in v0.10.0

func (m *MockState) TotalAccounts() int32

func (*MockState) TotalPower

func (m *MockState) TotalPower() int64

func (*MockState) TotalValidators added in v0.10.0

func (m *MockState) TotalValidators() int32

func (*MockState) UpdateLastCertificate

func (m *MockState) UpdateLastCertificate(cert *block.Certificate) error

func (*MockState) ValidateBlock

func (m *MockState) ValidateBlock(_ *block.Block) error

func (*MockState) ValidatorByAddress

func (m *MockState) ValidatorByAddress(addr crypto.Address) *validator.Validator

func (*MockState) ValidatorByNumber

func (m *MockState) ValidatorByNumber(n int32) *validator.Validator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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