Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- type Balance
- type Balances
- type Candidate
- type Candidates
- type Coin
- type FrozenFund
- type FrozenFunds
- type ImmutableTree
- func (t *ImmutableTree) DeleteVersion(version int64) error
- func (t *ImmutableTree) Get(key []byte) (index int64, value []byte)
- func (t *ImmutableTree) GetImmutable() *ImmutableTree
- func (t *ImmutableTree) GetImmutableAtHeight(version int64) (*ImmutableTree, error)
- func (t *ImmutableTree) Hash() []byte
- func (t *ImmutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *ImmutableTree) LazyLoadVersion(targetVersion int64) (int64, error)
- func (t *ImmutableTree) LoadVersion(targetVersion int64) (int64, error)
- func (t *ImmutableTree) Remove(key []byte) ([]byte, bool)
- func (t *ImmutableTree) SaveVersion() ([]byte, int64, error)
- func (t *ImmutableTree) Set(key, value []byte) bool
- func (t *ImmutableTree) Version() int64
- type Multisig
- type MutableTree
- func (t *MutableTree) DeleteVersion(version int64) error
- func (t *MutableTree) Get(key []byte) (index int64, value []byte)
- func (t *MutableTree) GetImmutable() *ImmutableTree
- func (t *MutableTree) GetImmutableAtHeight(version int64) (*ImmutableTree, error)
- func (t *MutableTree) Hash() []byte
- func (t *MutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
- func (t *MutableTree) LazyLoadVersion(targetVersion int64) (int64, error)
- func (t *MutableTree) LoadVersion(targetVersion int64) (int64, error)
- func (t *MutableTree) Remove(key []byte) ([]byte, bool)
- func (t *MutableTree) SaveVersion() ([]byte, int64, error)
- func (t *MutableTree) Set(key, value []byte) bool
- func (t *MutableTree) Version() int64
- type Stake
- type StakeCache
- type StateDB
- func (s *StateDB) AccountExists(address types.Address) bool
- func (s *StateDB) AddAccumReward(pubkey types.Pubkey, reward *big.Int)
- func (s *StateDB) AddBalance(addr types.Address, coinSymbol types.CoinSymbol, amount *big.Int)
- func (s *StateDB) AddCoinReserve(symbol types.CoinSymbol, value *big.Int)
- func (s *StateDB) AddCoinVolume(symbol types.CoinSymbol, value *big.Int)
- func (s *StateDB) AddTotalSlashed(value *big.Int)
- func (s *StateDB) CandidateExists(key types.Pubkey) bool
- func (s *StateDB) CandidatesCount() int
- func (s *StateDB) CheckForInvariants() error
- func (s *StateDB) Clear()
- func (s *StateDB) ClearCandidates()
- func (s *StateDB) ClearStakes()
- func (s *StateDB) CoinExists(symbol types.CoinSymbol) bool
- func (s *StateDB) Commit() (root []byte, version int64, err error)
- func (s *StateDB) CreateCandidate(rewardAddress types.Address, ownerAddress types.Address, pubkey types.Pubkey, ...) *stateCandidates
- func (s *StateDB) CreateCoin(symbol types.CoinSymbol, name string, volume *big.Int, crr uint, ...) *stateCoin
- func (s *StateDB) CreateMultisig(weights []uint, addresses []types.Address, threshold uint) types.Address
- func (s *StateDB) CreateValidator(rewardAddress types.Address, pubkey types.Pubkey, commission uint, ...) *stateValidators
- func (s *StateDB) DB() dbm.DB
- func (s *StateDB) Delegate(sender types.Address, pubkey []byte, coin types.CoinSymbol, value *big.Int)
- func (s *StateDB) EditCandidate(pubkey []byte, newRewardAddress types.Address, newOwnerAddress types.Address)
- func (s *StateDB) Export(currentHeight uint64) types.AppState
- func (s *StateDB) GetBalance(addr types.Address, coinSymbol types.CoinSymbol) *big.Int
- func (s *StateDB) GetBalances(addr types.Address) Balances
- func (s *StateDB) GetCandidates(count int, block int64) []Candidate
- func (s *StateDB) GetCurrentMaxGas() uint64
- func (s *StateDB) GetMaxGas() uint64
- func (s *StateDB) GetNonce(addr types.Address) uint64
- func (s *StateDB) GetOrNewStateFrozenFunds(blockHeight uint64) *stateFrozenFund
- func (s *StateDB) GetOrNewStateObject(addr types.Address) *stateAccount
- func (s *StateDB) GetStateCandidate(key types.Pubkey) *Candidate
- func (s *StateDB) GetStateCandidateByTmAddress(address [20]byte) *Candidate
- func (s *StateDB) GetStateCandidates() (stateCandidates *stateCandidates)
- func (s *StateDB) GetStateCoin(symbol types.CoinSymbol) *stateCoin
- func (s *StateDB) GetStateFrozenFunds(blockHeight uint64) *stateFrozenFund
- func (s *StateDB) GetStateValidators() (stateValidators *stateValidators)
- func (s *StateDB) GetTotalSlashed() *big.Int
- func (s *StateDB) Height() uint64
- func (s *StateDB) Import(appState types.AppState)
- func (s *StateDB) IsCheckUsed(check *check.Check) bool
- func (s *StateDB) IsDelegatorStakeSufficient(sender types.Address, pubKey []byte, coinSymbol types.CoinSymbol, ...) bool
- func (s *StateDB) IsNewCandidateStakeSufficient(coinSymbol types.CoinSymbol, stake *big.Int) bool
- func (s *StateDB) MarkStateCandidateDirty()
- func (s *StateDB) MarkStateCoinDirty(symbol types.CoinSymbol)
- func (s *StateDB) MarkStateFrozenFundsDirty(blockHeight uint64)
- func (s *StateDB) MarkStateObjectDirty(addr types.Address)
- func (s *StateDB) MarkStateValidatorsDirty()
- func (s *StateDB) MultisigAccountExists(address types.Address) bool
- func (s *StateDB) PayRewards()
- func (s *StateDB) PunishByzantineValidator(address [20]byte)
- func (s *StateDB) PunishFrozenFundsWithAddress(fromBlock uint64, toBlock uint64, address [20]byte)
- func (s *StateDB) RecalculateTotalStakeValues()
- func (s *StateDB) RemoveCurrentValidator(pubkey types.Pubkey)
- func (s *StateDB) SanitizeCoin(symbol types.CoinSymbol)
- func (s *StateDB) SetBalance(addr types.Address, coinSymbol types.CoinSymbol, amount *big.Int)
- func (s *StateDB) SetCandidateOffline(pubkey []byte)
- func (s *StateDB) SetCandidateOnline(pubkey []byte)
- func (s *StateDB) SetMaxGas(maxGas uint64)
- func (s *StateDB) SetNewValidators(candidates []Candidate)
- func (s *StateDB) SetNonce(addr types.Address, nonce uint64)
- func (s *StateDB) SetStateValidators(validators *stateValidators)
- func (s *StateDB) SetValidatorAbsent(address [20]byte)
- func (s *StateDB) SetValidatorPresent(address [20]byte)
- func (s *StateDB) StakeExists(owner types.Address, pubKey []byte, coinSymbol types.CoinSymbol) bool
- func (s *StateDB) SubBalance(addr types.Address, coinSymbol types.CoinSymbol, amount *big.Int)
- func (s *StateDB) SubCoinReserve(symbol types.CoinSymbol, value *big.Int)
- func (s *StateDB) SubCoinVolume(symbol types.CoinSymbol, value *big.Int)
- func (s *StateDB) SubStake(sender types.Address, pubkey []byte, coin types.CoinSymbol, value *big.Int)
- func (s *StateDB) UseCheck(check *check.Check)
- type Tree
- type Validator
- type Validators
Constants ¶
View Source
const ( CandidateStatusOffline = 0x01 CandidateStatusOnline = 0x02 )
View Source
const MaxDelegatorsPerCandidate = 1000
View Source
const UnbondPeriod = 1555200
Variables ¶
View Source
var ( ValidatorMaxAbsentWindow = 24 ValidatorMaxAbsentTimes = 12 )
Functions ¶
This section is empty.
Types ¶
type Account ¶
Account is the Noah consensus representation of accounts. These objects are stored in the main account trie.
type Candidate ¶
type Candidate struct { RewardAddress types.Address OwnerAddress types.Address TotalNoahStake *big.Int PubKey types.Pubkey Commission uint Stakes []Stake CreatedAtBlock uint Status byte // contains filtered or unexported fields }
func (Candidate) GetAddress ¶
func (Candidate) GetStakeOfAddress ¶
type Candidates ¶
type Candidates []Candidate
type Coin ¶
type FrozenFund ¶
type FrozenFunds ¶
type FrozenFunds struct {
List []FrozenFund
}
func (FrozenFunds) String ¶
func (f FrozenFunds) String() string
type ImmutableTree ¶
type ImmutableTree struct {
// contains filtered or unexported fields
}
func NewImmutableTree ¶
func NewImmutableTree(db dbm.DB) *ImmutableTree
func (*ImmutableTree) DeleteVersion ¶
func (t *ImmutableTree) DeleteVersion(version int64) error
func (*ImmutableTree) GetImmutable ¶
func (t *ImmutableTree) GetImmutable() *ImmutableTree
func (*ImmutableTree) GetImmutableAtHeight ¶
func (t *ImmutableTree) GetImmutableAtHeight(version int64) (*ImmutableTree, error)
func (*ImmutableTree) Hash ¶
func (t *ImmutableTree) Hash() []byte
func (*ImmutableTree) Iterate ¶
func (t *ImmutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
func (*ImmutableTree) LazyLoadVersion ¶
func (t *ImmutableTree) LazyLoadVersion(targetVersion int64) (int64, error)
func (*ImmutableTree) LoadVersion ¶
func (t *ImmutableTree) LoadVersion(targetVersion int64) (int64, error)
func (*ImmutableTree) SaveVersion ¶
func (t *ImmutableTree) SaveVersion() ([]byte, int64, error)
func (*ImmutableTree) Set ¶
func (t *ImmutableTree) Set(key, value []byte) bool
func (*ImmutableTree) Version ¶
func (t *ImmutableTree) Version() int64
type MutableTree ¶
type MutableTree struct {
// contains filtered or unexported fields
}
func NewMutableTree ¶
func NewMutableTree(db dbm.DB) *MutableTree
func (*MutableTree) DeleteVersion ¶
func (t *MutableTree) DeleteVersion(version int64) error
func (*MutableTree) GetImmutable ¶
func (t *MutableTree) GetImmutable() *ImmutableTree
func (*MutableTree) GetImmutableAtHeight ¶
func (t *MutableTree) GetImmutableAtHeight(version int64) (*ImmutableTree, error)
func (*MutableTree) Hash ¶
func (t *MutableTree) Hash() []byte
func (*MutableTree) Iterate ¶
func (t *MutableTree) Iterate(fn func(key []byte, value []byte) bool) (stopped bool)
func (*MutableTree) LazyLoadVersion ¶
func (t *MutableTree) LazyLoadVersion(targetVersion int64) (int64, error)
func (*MutableTree) LoadVersion ¶
func (t *MutableTree) LoadVersion(targetVersion int64) (int64, error)
func (*MutableTree) SaveVersion ¶
func (t *MutableTree) SaveVersion() ([]byte, int64, error)
func (*MutableTree) Set ¶
func (t *MutableTree) Set(key, value []byte) bool
func (*MutableTree) Version ¶
func (t *MutableTree) Version() int64
type StateDB ¶
type StateDB struct {
// contains filtered or unexported fields
}
func NewForCheckFromDeliver ¶
func (*StateDB) AddAccumReward ¶
func (*StateDB) AddBalance ¶
AddBalance adds amount to the account associated with addr
func (*StateDB) AddCoinReserve ¶
func (s *StateDB) AddCoinReserve(symbol types.CoinSymbol, value *big.Int)
func (*StateDB) AddCoinVolume ¶
func (s *StateDB) AddCoinVolume(symbol types.CoinSymbol, value *big.Int)
func (*StateDB) AddTotalSlashed ¶
func (*StateDB) CandidatesCount ¶
func (*StateDB) CheckForInvariants ¶
func (*StateDB) ClearCandidates ¶
func (s *StateDB) ClearCandidates()
func (*StateDB) ClearStakes ¶
func (s *StateDB) ClearStakes()
func (*StateDB) CoinExists ¶
func (s *StateDB) CoinExists(symbol types.CoinSymbol) bool
func (*StateDB) CreateCandidate ¶
func (*StateDB) CreateCoin ¶
func (*StateDB) CreateMultisig ¶
func (*StateDB) CreateValidator ¶
func (*StateDB) EditCandidate ¶
func (*StateDB) GetBalance ¶
Retrieve the balance from the given address or 0 if object not found
func (*StateDB) GetCurrentMaxGas ¶
func (*StateDB) GetOrNewStateFrozenFunds ¶
func (*StateDB) GetOrNewStateObject ¶
Retrieve a state object or create a new state object if nil
func (*StateDB) GetStateCandidate ¶
func (*StateDB) GetStateCandidateByTmAddress ¶
func (*StateDB) GetStateCandidates ¶
func (s *StateDB) GetStateCandidates() (stateCandidates *stateCandidates)
func (*StateDB) GetStateCoin ¶
func (s *StateDB) GetStateCoin(symbol types.CoinSymbol) *stateCoin
func (*StateDB) GetStateFrozenFunds ¶
func (*StateDB) GetStateValidators ¶
func (s *StateDB) GetStateValidators() (stateValidators *stateValidators)
func (*StateDB) GetTotalSlashed ¶
func (*StateDB) IsDelegatorStakeSufficient ¶
func (*StateDB) IsNewCandidateStakeSufficient ¶
func (*StateDB) MarkStateCandidateDirty ¶
func (s *StateDB) MarkStateCandidateDirty()
func (*StateDB) MarkStateCoinDirty ¶
func (s *StateDB) MarkStateCoinDirty(symbol types.CoinSymbol)
func (*StateDB) MarkStateFrozenFundsDirty ¶
func (*StateDB) MarkStateObjectDirty ¶
MarkStateObjectDirty adds the specified object to the dirty map to avoid costly state object cache iteration to find a handful of modified ones.
func (*StateDB) MarkStateValidatorsDirty ¶
func (s *StateDB) MarkStateValidatorsDirty()
func (*StateDB) MultisigAccountExists ¶
func (*StateDB) PayRewards ¶
func (s *StateDB) PayRewards()
func (*StateDB) PunishByzantineValidator ¶
func (*StateDB) PunishFrozenFundsWithAddress ¶
func (*StateDB) RecalculateTotalStakeValues ¶
func (s *StateDB) RecalculateTotalStakeValues()
func (*StateDB) RemoveCurrentValidator ¶
func (*StateDB) SanitizeCoin ¶
func (s *StateDB) SanitizeCoin(symbol types.CoinSymbol)
func (*StateDB) SetBalance ¶
func (*StateDB) SetCandidateOffline ¶
func (*StateDB) SetCandidateOnline ¶
func (*StateDB) SetNewValidators ¶
func (*StateDB) SetStateValidators ¶
func (s *StateDB) SetStateValidators(validators *stateValidators)
func (*StateDB) SetValidatorAbsent ¶
func (*StateDB) SetValidatorPresent ¶
func (*StateDB) StakeExists ¶
func (*StateDB) SubBalance ¶
SubBalance subtracts amount from the account associated with addr
func (*StateDB) SubCoinReserve ¶
func (s *StateDB) SubCoinReserve(symbol types.CoinSymbol, value *big.Int)
func (*StateDB) SubCoinVolume ¶
func (s *StateDB) SubCoinVolume(symbol types.CoinSymbol, value *big.Int)
type Tree ¶
type Tree interface { Get(key []byte) (index int64, value []byte) Set(key, value []byte) bool Remove(key []byte) ([]byte, bool) LoadVersion(targetVersion int64) (int64, error) LazyLoadVersion(targetVersion int64) (int64, error) SaveVersion() ([]byte, int64, error) DeleteVersion(version int64) error GetImmutable() *ImmutableTree GetImmutableAtHeight(version int64) (*ImmutableTree, error) Version() int64 Hash() []byte Iterate(fn func(key []byte, value []byte) bool) (stopped bool) }
type Validator ¶
type Validator struct { RewardAddress types.Address TotalNoahStake *big.Int PubKey types.Pubkey Commission uint AccumReward *big.Int AbsentTimes *types.BitArray // contains filtered or unexported fields }
func (*Validator) CountAbsentTimes ¶
func (Validator) GetAddress ¶
type Validators ¶
type Validators []Validator
Click to show internal directories.
Click to hide internal directories.