Documentation
¶
Index ¶
- func DeepCopy(dst, src interface{}) error
- type AccountMap
- type AccountMapItem
- type CurrEpochValData
- type CurrentHeightValData
- type EthAccounts
- type HardForkExpectedData
- type MinerRewardStrategy
- type NextEpochValData
- type Proposer
- type Strategy
- func (strategy *Strategy) CollectTx(tx *ethTypes.Transaction)
- func (strategy *Strategy) GetUpdatedValidators() []abciTypes.ValidatorUpdate
- func (strategy *Strategy) Receiver() common.Address
- func (strategy *Strategy) SetInitialAccountMap(accountMapList *AccountMap)
- func (strategy *Strategy) SetValidators(validators []abciTypes.ValidatorUpdate)
- type Validator
- type ValidatorsStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountMap ¶
type AccountMap struct {
MapList map[string]*AccountMapItem `json:"map_list"`
FilePath string `json:"filePath"`
// contains filtered or unexported fields
}
func AccountMapFromFile ¶
func AccountMapFromFile(AccountMapFile string) (*AccountMap, error)
AccountMapFromJSON reads JSON data from a file and unmarshalls it into a AccountMapList.
func AccountMapFromJSON ¶
func AccountMapFromJSON(jsonBlob []byte) (*AccountMap, error)
AccountMapFromJSON unmarshalls JSON data into a AccountMapList.
func (*AccountMap) Copy ¶
func (am *AccountMap) Copy() *AccountMap
func (*AccountMap) GenAccountMapList ¶
func (am *AccountMap) GenAccountMapList(filePath string) *AccountMap
GenFilePV generates a new validator with randomly generated private key and sets the filePath, but does not call Save().
type AccountMapItem ¶
AccountMapItem connects tm address with eth address and blsPubKey
func (*AccountMapItem) Copy ¶
func (accountMapItem *AccountMapItem) Copy() *AccountMapItem
type CurrEpochValData ¶
type CurrentHeightValData ¶
type EthAccounts ¶
type EthAccounts struct {
EthAccounts []string `json:"ethAccounts"`
EthBalances []*big.Int `json:"ethBalances"`
EthBeneficiarys []string `json:"ethBeneficiarys"`
}
func EthAccountsFromJSON ¶
func EthAccountsFromJSON(jsonBlob []byte) (*EthAccounts, error)
EthAccountsFromJSON unmarshalls JSON data into a eth accounts.
func GetInitialEthAccountFromFile ¶
func GetInitialEthAccountFromFile(EthAccountsPath string) (*EthAccounts, error)
GetInitialEthAccountFromFile reads JSON data from a file and unmarshalls it into a initial eth accounts.
type HardForkExpectedData ¶
type HardForkExpectedData struct {
Height int64 // should remember and update it for every block to remember what height we located
IsHarfForkPassed bool // This flag is used to record whether the hardfork was passed by most of validators
// This flag is used to record the hard fork version that most of nodes want to upgrade
// If the statistic process doesn't exist, statisticsVersion = 0 , use const NextHardForkVersion = 2
StatisticsVersion uint64
//This variable is used to record the statisticHeight that most of nodes want to upgrade
//If the statistic process doesn't exist,statisticsHeight = 0 ,use const NextHardForkHeight = 2
StatisticHeight int64
//This variable is used to record the block was generated by whick version
BlockVersion uint64
}
no need to be persisted
type MinerRewardStrategy ¶
MinerRewardStrategy is a mining strategy
type NextEpochValData ¶
type Strategy ¶
type Strategy struct {
MinerRewardStrategy
ValidatorsStrategy
InitialValidators []abciTypes.ValidatorUpdate
//initial bond accounts
AccMapInitial *AccountMap
//needn't to be persisted
BlsSelectStrategy bool
// need persist every height
CurrentHeightValData CurrentHeightValData
// need persist when epoch changes
CurrEpochValData CurrEpochValData
// need persist when epoch changes or changed this block
NextEpochValData NextEpochValData
// add for hard fork
HFExpectedData HardForkExpectedData
// contains filtered or unexported fields
}
Strategy encompasses all available strategies
func NewStrategy ¶
func NewStrategy() *Strategy
func (*Strategy) CollectTx ¶
func (strategy *Strategy) CollectTx(tx *ethTypes.Transaction)
CollectTx collects the rewards for a transaction
func (*Strategy) GetUpdatedValidators ¶
func (strategy *Strategy) GetUpdatedValidators() []abciTypes.ValidatorUpdate
GetUpdatedValidators returns the current validators, old code
func (*Strategy) SetInitialAccountMap ¶
func (strategy *Strategy) SetInitialAccountMap(accountMapList *AccountMap)
func (*Strategy) SetValidators ¶
func (strategy *Strategy) SetValidators(validators []abciTypes.ValidatorUpdate)
SetValidators updates the current validators
type ValidatorsStrategy ¶
type ValidatorsStrategy interface {
SetValidators(validators []*abciTypes.Validator)
CollectTx(tx *ethTypes.Transaction)
GetUpdatedValidators() []*abciTypes.Validator
}
ValidatorsStrategy is a validator strategy