Documentation ¶
Index ¶
- Constants
- Variables
- func DryRunUpdateEpochValidatorSet(state *state.StateDB, validators *ncTypes.ValidatorSet, ...) error
- func SaveEpochVoteSet(epochDB db.DB, epochNumber uint64, voteSet *EpochValidatorVoteSet)
- func UpdateEpochEndTime(db dbm.DB, epNumber uint64, endTime time.Time)
- type Epoch
- func (epoch *Epoch) Bytes() []byte
- func (epoch *Epoch) Copy() *Epoch
- func (epoch *Epoch) EnterNewEpoch(newValidators *ncTypes.ValidatorSet) (*Epoch, error)
- func (epoch *Epoch) Equals(other *Epoch, checkPrevNext bool) bool
- func (epoch *Epoch) GetDB() dbm.DB
- func (epoch *Epoch) GetEpochByBlockNumber(blockNumber uint64) *Epoch
- func (epoch *Epoch) GetEpochValidatorVoteSet() *EpochValidatorVoteSet
- func (epoch *Epoch) GetNextEpoch() *Epoch
- func (epoch *Epoch) GetPreviousEpoch() *Epoch
- func (epoch *Epoch) GetRewardScheme() *RewardScheme
- func (epoch *Epoch) ProposeNextEpoch(lastBlockHeight uint64, lastBlockTime time.Time) *Epoch
- func (epoch *Epoch) Save()
- func (epoch *Epoch) SetNextEpoch(next *Epoch)
- func (epoch *Epoch) SetRewardScheme(rs *RewardScheme)
- func (epoch *Epoch) ShouldEnterNewEpoch(height uint64, state *state.StateDB) (bool, *ncTypes.ValidatorSet, error)
- func (epoch *Epoch) ShouldProposeNextEpoch(curBlockHeight uint64) bool
- func (epoch *Epoch) String() string
- func (epoch *Epoch) ValidateNextEpoch(next *Epoch, lastHeight uint64, lastBlockTime time.Time) error
- type EpochValidatorVote
- type EpochValidatorVoteSet
- func (voteSet *EpochValidatorVoteSet) Copy() *EpochValidatorVoteSet
- func (voteSet *EpochValidatorVoteSet) GetVoteByAddress(address common.Address) (vote *EpochValidatorVote, exist bool)
- func (voteSet *EpochValidatorVoteSet) IsEmpty() bool
- func (voteSet *EpochValidatorVoteSet) StoreVote(vote *EpochValidatorVote)
- type RewardScheme
Constants ¶
View Source
const ( EPOCH_NOT_EXIST = iota EPOCH_PROPOSED_NOT_VOTED EPOCH_VOTED_NOT_SAVED EPOCH_SAVED MinimumValidatorsSize = 1 MaximumValidatorsSize = 40 )
Variables ¶
View Source
var BannedEpoch = big.NewInt(2)
View Source
var NextEpochNotEXPECTED = errors.New("next epoch parameters are not excepted, fatal error")
View Source
var NextEpochNotExist = errors.New("next epoch parameters do not exist, fatal error")
Functions ¶
func DryRunUpdateEpochValidatorSet ¶
func DryRunUpdateEpochValidatorSet(state *state.StateDB, validators *ncTypes.ValidatorSet, voteSet *EpochValidatorVoteSet) error
func SaveEpochVoteSet ¶
func SaveEpochVoteSet(epochDB db.DB, epochNumber uint64, voteSet *EpochValidatorVoteSet)
Types ¶
type Epoch ¶
type Epoch struct { Number uint64 RewardPerBlock *big.Int StartBlock uint64 EndBlock uint64 StartTime time.Time EndTime time.Time BlockGenerated int Status int Validators *ncTypes.ValidatorSet // contains filtered or unexported fields }
func MakeOneEpoch ¶
func (*Epoch) EnterNewEpoch ¶
func (epoch *Epoch) EnterNewEpoch(newValidators *ncTypes.ValidatorSet) (*Epoch, error)
func (*Epoch) GetEpochByBlockNumber ¶
func (*Epoch) GetEpochValidatorVoteSet ¶
func (epoch *Epoch) GetEpochValidatorVoteSet() *EpochValidatorVoteSet
func (*Epoch) GetNextEpoch ¶
func (*Epoch) GetPreviousEpoch ¶
func (*Epoch) GetRewardScheme ¶
func (epoch *Epoch) GetRewardScheme() *RewardScheme
func (*Epoch) ProposeNextEpoch ¶
func (*Epoch) SetNextEpoch ¶
func (*Epoch) SetRewardScheme ¶
func (epoch *Epoch) SetRewardScheme(rs *RewardScheme)
func (*Epoch) ShouldEnterNewEpoch ¶
func (*Epoch) ShouldProposeNextEpoch ¶
type EpochValidatorVote ¶
type EpochValidatorVote struct { Address common.Address PubKey crypto.PubKey Amount *big.Int Salt string VoteHash common.Hash TxHash common.Hash }
func (*EpochValidatorVote) Copy ¶
func (vote *EpochValidatorVote) Copy() *EpochValidatorVote
type EpochValidatorVoteSet ¶
type EpochValidatorVoteSet struct { Votes []*EpochValidatorVote // contains filtered or unexported fields }
func LoadEpochVoteSet ¶
func LoadEpochVoteSet(epochDB db.DB, epochNumber uint64) *EpochValidatorVoteSet
func NewEpochValidatorVoteSet ¶
func NewEpochValidatorVoteSet() *EpochValidatorVoteSet
func (*EpochValidatorVoteSet) Copy ¶
func (voteSet *EpochValidatorVoteSet) Copy() *EpochValidatorVoteSet
func (*EpochValidatorVoteSet) GetVoteByAddress ¶
func (voteSet *EpochValidatorVoteSet) GetVoteByAddress(address common.Address) (vote *EpochValidatorVote, exist bool)
func (*EpochValidatorVoteSet) IsEmpty ¶
func (voteSet *EpochValidatorVoteSet) IsEmpty() bool
func (*EpochValidatorVoteSet) StoreVote ¶
func (voteSet *EpochValidatorVoteSet) StoreVote(vote *EpochValidatorVote)
type RewardScheme ¶
type RewardScheme struct { TotalReward *big.Int RewardFirstYear *big.Int EpochNumberPerYear uint64 TotalYear uint64 // contains filtered or unexported fields }
func LoadRewardScheme ¶
func LoadRewardScheme(db dbm.DB) *RewardScheme
func MakeRewardScheme ¶
func MakeRewardScheme(db dbm.DB, rsDoc *ncTypes.RewardSchemeDoc) *RewardScheme
func (*RewardScheme) Save ¶
func (rs *RewardScheme) Save()
func (*RewardScheme) String ¶
func (rs *RewardScheme) String() string
Click to show internal directories.
Click to hide internal directories.