Documentation ¶
Index ¶
- Variables
- type Facade
- type InvalidBlockTimeError
- type InvalidProposerError
- type InvalidStateRootHashError
- type InvalidSubsidyAmountError
- type InvalidVoteForCertificateError
- type MockState
- func (m *MockState) AccountByAddress(addr crypto.Address) *account.Account
- func (m *MockState) AccountByNumber(number int32) *account.Account
- func (m *MockState) AddPendingTx(trx *tx.Tx) error
- func (m *MockState) AddPendingTxAndBroadcast(trx *tx.Tx) error
- func (m *MockState) AllPendingTxs() []*tx.Tx
- func (*MockState) AvailabilityScore(_ int32) float64
- func (m *MockState) BlockHash(height uint32) hash.Hash
- func (m *MockState) BlockHeight(h hash.Hash) uint32
- func (m *MockState) CalculateFee(amt amount.Amount, payloadType payload.Type) amount.Amount
- func (*MockState) Close()
- func (m *MockState) CommitBlock(blk *block.Block, cert *certificate.BlockCertificate) error
- func (m *MockState) CommitTestBlocks(num int)
- func (m *MockState) CommittedBlock(height uint32) *store.CommittedBlock
- func (m *MockState) CommittedTx(txID tx.ID) *store.CommittedTx
- func (m *MockState) CommitteePower() int64
- func (m *MockState) CommitteeValidators() []*validator.Validator
- func (m *MockState) Genesis() *genesis.Genesis
- func (m *MockState) IsInCommittee(addr crypto.Address) bool
- func (m *MockState) IsProposer(addr crypto.Address, round int16) bool
- func (m *MockState) IsPruned() bool
- func (m *MockState) IsValidator(addr crypto.Address) bool
- func (m *MockState) LastBlockHash() hash.Hash
- func (m *MockState) LastBlockHeight() uint32
- func (m *MockState) LastBlockTime() time.Time
- func (m *MockState) LastCertificate() *certificate.BlockCertificate
- func (m *MockState) Params() *param.Params
- func (m *MockState) PendingTx(txID tx.ID) *tx.Tx
- func (m *MockState) ProposeBlock(valKey *bls.ValidatorKey, _ crypto.Address) (*block.Block, error)
- func (m *MockState) Proposer(round int16) *validator.Validator
- func (m *MockState) PruningHeight() uint32
- func (m *MockState) PublicKey(addr crypto.Address) (crypto.PublicKey, error)
- func (m *MockState) TotalAccounts() int32
- func (m *MockState) TotalPower() int64
- func (m *MockState) TotalValidators() int32
- func (*MockState) UpdateLastCertificate(_ *vote.Vote) error
- func (*MockState) ValidateBlock(_ *block.Block, _ int16) error
- func (m *MockState) ValidatorAddresses() []crypto.Address
- func (m *MockState) ValidatorByAddress(addr crypto.Address) *validator.Validator
- func (m *MockState) ValidatorByNumber(n int32) *validator.Validator
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicatedSubsidyTransaction = errors.New("duplicated subsidy transaction")
ErrDuplicatedSubsidyTransaction indicates that there is more than one subsidy transaction inside the block.
var ErrInvalidBlockVersion = errors.New("invalid block version")
ErrInvalidBlockVersion indicates that the block version is not valid.
var ErrInvalidCertificate = errors.New("invalid certificate")
ErrInvalidCertificate indicates that the block certificate is invalid.
var ErrInvalidSortitionSeed = errors.New("invalid sortition seed")
ErrInvalidSortitionSeed indicates that the block's sortition seed is either invalid or unverifiable.
var ErrInvalidSubsidyTransaction = errors.New("invalid subsidy transaction")
ErrInvalidSubsidyTransaction indicates that the subsidy transaction is not valid.
Functions ¶
This section is empty.
Types ¶
type Facade ¶
type Facade interface { Genesis() *genesis.Genesis LastBlockHeight() uint32 LastBlockHash() hash.Hash LastBlockTime() time.Time LastCertificate() *certificate.BlockCertificate UpdateLastCertificate(v *vote.Vote) error ProposeBlock(valKey *bls.ValidatorKey, rewardAddr crypto.Address) (*block.Block, error) ValidateBlock(blk *block.Block, round int16) error CommitBlock(blk *block.Block, cert *certificate.BlockCertificate) 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(txID tx.ID) *tx.Tx AddPendingTx(trx *tx.Tx) error AddPendingTxAndBroadcast(trx *tx.Tx) error CommittedBlock(height uint32) *store.CommittedBlock CommittedTx(txID tx.ID) *store.CommittedTx BlockHash(height uint32) hash.Hash BlockHeight(h hash.Hash) uint32 AccountByAddress(addr crypto.Address) *account.Account ValidatorByAddress(addr crypto.Address) *validator.Validator ValidatorByNumber(number int32) *validator.Validator ValidatorAddresses() []crypto.Address Params() *param.Params Close() CalculateFee(amt amount.Amount, payloadType payload.Type) amount.Amount PublicKey(addr crypto.Address) (crypto.PublicKey, error) AvailabilityScore(valNum int32) float64 AllPendingTxs() []*tx.Tx IsPruned() bool PruningHeight() uint32 }
type InvalidBlockTimeError ¶ added in v1.5.0
type InvalidBlockTimeError struct {
Reason string
}
InvalidBlockTimeError is returned when the block time is not valid.
func (InvalidBlockTimeError) Error ¶ added in v1.5.0
func (e InvalidBlockTimeError) Error() string
type InvalidProposerError ¶ added in v1.5.0
InvalidProposerError is returned when the block proposer is not as expected.
func (InvalidProposerError) Error ¶ added in v1.5.0
func (e InvalidProposerError) Error() string
type InvalidStateRootHashError ¶ added in v1.5.0
InvalidStateRootHashError is returned when the state root hash of the block does not match the current state root hash.
func (InvalidStateRootHashError) Error ¶ added in v1.5.0
func (e InvalidStateRootHashError) Error() string
type InvalidSubsidyAmountError ¶ added in v1.5.0
InvalidSubsidyAmountError is returned when the amount of the subsidy transaction is not as expected.
func (InvalidSubsidyAmountError) Error ¶ added in v1.5.0
func (e InvalidSubsidyAmountError) Error() string
type InvalidVoteForCertificateError ¶ added in v0.15.0
InvalidVoteForCertificateError is returned when an attempt to update the last certificate with an invalid vote is made.
func (InvalidVoteForCertificateError) Error ¶ added in v0.15.0
func (e InvalidVoteForCertificateError) Error() string
type MockState ¶
type MockState struct { TestGenesis *genesis.Genesis TestStore *store.MockStore TestPool *txpool.MockTxPool TestCommittee committee.Committee TestValKeys []*bls.ValidatorKey TestParams *param.Params // contains filtered or unexported fields }
func MockingState ¶
func (*MockState) AccountByAddress ¶
func (*MockState) AccountByNumber ¶ added in v0.12.0
func (*MockState) AddPendingTxAndBroadcast ¶
func (*MockState) AllPendingTxs ¶ added in v1.3.0
func (*MockState) AvailabilityScore ¶ added in v0.19.0
func (*MockState) CalculateFee ¶ added in v0.15.0
func (*MockState) CommitBlock ¶
func (m *MockState) CommitBlock(blk *block.Block, cert *certificate.BlockCertificate) error
func (*MockState) CommitTestBlocks ¶
func (*MockState) CommittedBlock ¶ added in v0.15.0
func (m *MockState) CommittedBlock(height uint32) *store.CommittedBlock
func (*MockState) CommittedTx ¶ added in v0.15.0
func (m *MockState) CommittedTx(txID tx.ID) *store.CommittedTx
func (*MockState) CommitteePower ¶
func (*MockState) CommitteeValidators ¶
func (*MockState) IsProposer ¶
func (*MockState) LastBlockHash ¶
func (*MockState) LastBlockHeight ¶
func (*MockState) LastBlockTime ¶
func (*MockState) LastCertificate ¶
func (m *MockState) LastCertificate() *certificate.BlockCertificate