types

package
v1.2.1-patch4 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopy

func DeepCopy(dst, src interface{}) error

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().

func (*AccountMap) Save

func (am *AccountMap) Save()

Save persists the FilePV to disk.

type AccountMapItem

type AccountMapItem struct {
	Signer       common.Address
	Beneficiary  common.Address
	BlsKeyString string
}

AccountMapItem connects tm address with eth address and blsPubKey

func (*AccountMapItem) Copy

func (accountMapItem *AccountMapItem) Copy() *AccountMapItem

type CurrEpochValData

type CurrEpochValData struct {
	// will be changed by addValidatorTx and removeValidatorTx.
	PosTable *txfilter.PosTable `json:"pos_table"`

	TotalBalance *big.Int `json:"total_balance"`
	MinorBonus   *big.Int `json:"-"` //all voted validators share this bonus per block.
}

type CurrentHeightValData

type CurrentHeightValData struct {
	Height int64 `json:"height"`

	Validators map[string]Validator `json:"validators"`

	ProposerAddress string `json:"-"`

	LastVoteInfo []abciTypes.VoteInfo `json:"-"`
}

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

type MinerRewardStrategy interface {
	Receiver() common.Address
}

MinerRewardStrategy is a mining strategy

type NextEpochValData

type NextEpochValData struct {
	//deepcopy from NextEpochValData to CurrEpochValData each epoch
	PosTable *txfilter.PosTable
}

type Proposer

type Proposer struct {
	Receiver string `json:"receiver"`
}

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) Receiver

func (strategy *Strategy) Receiver() common.Address

Receiver returns which address should receive the mining reward

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 Validator

type Validator struct {
	abciTypes.ValidatorUpdate
	Signer common.Address
}

type ValidatorsStrategy

type ValidatorsStrategy interface {
	SetValidators(validators []*abciTypes.Validator)
	CollectTx(tx *ethTypes.Transaction)
	GetUpdatedValidators() []*abciTypes.Validator
}

ValidatorsStrategy is a validator strategy

Jump to

Keyboard shortcuts

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