Documentation ¶
Index ¶
- Constants
- Variables
- func AppendDelegateRewardPer(blockHash common.Hash, nodeID enode.IDv0, stakingNum uint64, ...) error
- func CheckOperatingThreshold(blockNumber uint64, blockHash common.Hash, balance *big.Int) (bool, *big.Int)
- func CheckStakeThreshold(blockNumber uint64, blockHash common.Hash, stake *big.Int) (bool, *big.Int)
- func Decimal(value float64) int
- func GetBlockNumberByEpoch(epoch uint64) uint64
- func GetHistoryCumulativeIssue(state xcom.StateDB, year uint32) *big.Int
- func GetYearEndBalance(state xcom.StateDB, year uint32) *big.Int
- func LoadChainYearNumber(hash common.Hash, snapshotDB snapshotdb.DB) (uint32, error)
- func LoadNewBlockReward(hash common.Hash, snapshotDB snapshotdb.DB) (*big.Int, error)
- func LoadRemainingReward(hash common.Hash, snapshotDB snapshotdb.DB) (*big.Int, error)
- func LoadStakingReward(hash common.Hash, snapshotDB snapshotdb.DB) (*big.Int, error)
- func LoadYearStartTime(hash common.Hash, snapshotDB snapshotdb.DB) (yearStartBlockNumber uint64, yearStartTime int64, error error)
- func SetYearEndBalance(state xcom.StateDB, year uint32, balance *big.Int)
- func SetYearEndCumulativeIssue(state xcom.StateDB, year uint32, total *big.Int)
- func StorageChainYearNumber(hash common.Hash, snapshotDB snapshotdb.DB, yearNumber uint32) error
- func StorageNewBlockReward(hash common.Hash, snapshotDB snapshotdb.DB, newBlockReward *big.Int) error
- func StorageRemainingReward(hash common.Hash, snapshotDB snapshotdb.DB, remainReward *big.Int) error
- func StorageStakingReward(hash common.Hash, snapshotDB snapshotdb.DB, stakingReward *big.Int) error
- func StorageYearStartTime(hash common.Hash, snapshotDB snapshotdb.DB, blockNumber uint64, ...) error
- func UpdateDelegateRewardPer(blockHash common.Hash, nodeID enode.IDv0, stakingNum uint64, ...) error
- func VerifyTxData(input []byte, command map[uint16]interface{}) (cnCode uint16, fn interface{}, FnParams []reflect.Value, err error)
- type BasePlugin
- type DelegationInfoWithRewardPerList
- type GovPlugin
- func (govPlugin *GovPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (govPlugin *GovPlugin) Confirmed(nodeId enode.IDv0, block *types.Block) error
- func (govPlugin *GovPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (govPlugin *GovPlugin) SetChainDB(chainDB ethdb.Writer)
- func (govPlugin *GovPlugin) SetChainID(chainId *big.Int)
- type PublicPPOSAPI
- type RestrictingPlugin
- func (rp *RestrictingPlugin) AddRestrictingRecord(from, account common.Address, blockNum uint64, blockHash common.Hash, ...) error
- func (rp *RestrictingPlugin) AdvanceLockedFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
- func (rp *RestrictingPlugin) BeginBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
- func (rp *RestrictingPlugin) Confirmed(nodeId enode.IDv0, block *types.Block) error
- func (rp *RestrictingPlugin) EndBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
- func (rp *RestrictingPlugin) GetRestrictingInfo(account common.Address, state xcom.StateDB) (*restricting.Result, *common.BizError)
- func (rp *RestrictingPlugin) InitGenesisRestrictingPlans(statedb xcom.StateDB) error
- func (rp *RestrictingPlugin) MixAdvanceLockedFunds(account common.Address, amount *big.Int, state xcom.StateDB) (*big.Int, *big.Int, error)
- func (rp *RestrictingPlugin) ReturnLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
- func (rp *RestrictingPlugin) SlashingNotify(account common.Address, amount *big.Int, state xcom.StateDB) error
- type RewardMgrPlugin
- func (rmp *RewardMgrPlugin) AllocatePackageBlock(blockHash common.Hash, head *types.Header, reward *big.Int, state xcom.StateDB) error
- func (rmp *RewardMgrPlugin) AllocateStakingReward(blockNumber uint64, blockHash common.Hash, sreward *big.Int, ...) ([]*staking.Candidate, error)
- func (rmp *RewardMgrPlugin) BeginBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
- func (rmp *RewardMgrPlugin) CalDelegateRewardAndNodeReward(totalReward *big.Int, per uint16) (*big.Int, *big.Int)
- func (rmp *RewardMgrPlugin) CalcEpochReward(blockHash common.Hash, head *types.Header, state xcom.StateDB) (*big.Int, *big.Int, error)
- func (rmp *RewardMgrPlugin) Confirmed(nodeId enode.IDv0, block *types.Block) error
- func (rmp *RewardMgrPlugin) EndBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
- func (rmp *RewardMgrPlugin) GetDelegateReward(blockHash common.Hash, blockNum uint64, account common.Address, ...) ([]reward.NodeDelegateRewardPresenter, error)
- func (rmp *RewardMgrPlugin) GetDelegateRewardPerList(blockHash common.Hash, nodeID enode.IDv0, ...) ([]*reward.DelegateRewardPer, error)
- func (rmp *RewardMgrPlugin) HandleDelegatePerReward(blockHash common.Hash, blockNumber uint64, list []*staking.Candidate, ...) error
- func (rmp *RewardMgrPlugin) ReturnDelegateReward(address common.Address, amount *big.Int, state xcom.StateDB) error
- func (rmp *RewardMgrPlugin) SetCurrentNodeID(nodeId enode.IDv0)
- func (rmp *RewardMgrPlugin) WithdrawDelegateReward(blockHash common.Hash, blockNum uint64, account common.Address, ...) ([]reward.NodeDelegateReward, error)
- type SlashingPlugin
- func (sp *SlashingPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sp *SlashingPlugin) CheckDuplicateSign(nodeId enode.IDv0, blockNumber uint64, dupType consensus.EvidenceType, ...) ([]byte, error)
- func (sp *SlashingPlugin) Confirmed(nodeId enode.IDv0, block *types.Block) error
- func (sp *SlashingPlugin) DecodeEvidence(dupType consensus.EvidenceType, data string) (consensus.Evidence, error)
- func (sp *SlashingPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sp *SlashingPlugin) GetPrePackAmount(blockNumber uint64, parentHash common.Hash) (map[enode.IDv0]uint32, error)
- func (sp *SlashingPlugin) SetDecodeEvidenceFun(...)
- func (sp *SlashingPlugin) SetPrivateKey(privateKey *ecdsa.PrivateKey)
- func (sp *SlashingPlugin) Slash(evidence consensus.Evidence, blockHash common.Hash, blockNumber uint64, ...) error
- type StakingPlugin
- func (sk *StakingPlugin) AdvanceDelegationLockedFunds(blockHash common.Hash, account common.Address, currentEpoch uint32, ...) (*big.Int, *big.Int, error)
- func (sk *StakingPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sk *StakingPlugin) Confirmed(nodeId enode.IDv0, block *types.Block) error
- func (sk *StakingPlugin) CreateCandidate(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, ...) error
- func (sk *StakingPlugin) DeclarePromoteNotify(blockHash common.Hash, blockNumber uint64, nodeId enode.IDv0, ...) error
- func (sk *StakingPlugin) Delegate(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) error
- func (sk *StakingPlugin) EditCandidate(blockHash common.Hash, blockNumber *big.Int, canAddr common.NodeAddress, ...) error
- func (sk *StakingPlugin) ElectNextVerifierList(blockHash common.Hash, blockNumber uint64, state xcom.StateDB) error
- func (sk *StakingPlugin) Election(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sk *StakingPlugin) EnableValidatorsHistory()
- func (sk *StakingPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
- func (sk *StakingPlugin) GetCanBase(blockHash common.Hash, addr common.NodeAddress) (*staking.CandidateBase, error)
- func (sk *StakingPlugin) GetCanBaseByIrr(addr common.NodeAddress) (*staking.CandidateBase, error)
- func (sk *StakingPlugin) GetCanBaseList(blockHash common.Hash, blockNumber uint64) (staking.CandidateBaseQueue, error)
- func (sk *StakingPlugin) GetCanMutable(blockHash common.Hash, addr common.NodeAddress) (*staking.CandidateMutable, error)
- func (sk *StakingPlugin) GetCanMutableByIrr(addr common.NodeAddress) (*staking.CandidateMutable, error)
- func (sk *StakingPlugin) GetCandidateCompactInfo(blockHash common.Hash, blockNumber uint64, addr common.NodeAddress) (*staking.CandidateHex, error)
- func (sk *StakingPlugin) GetCandidateInfo(blockHash common.Hash, addr common.NodeAddress) (*staking.Candidate, error)
- func (sk *StakingPlugin) GetCandidateInfoByIrr(addr common.NodeAddress) (*staking.Candidate, error)
- func (sk *StakingPlugin) GetCandidateList(blockHash common.Hash, blockNumber uint64) (staking.CandidateHexQueue, error)
- func (sk *StakingPlugin) GetCandidateONEpoch(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.CandidateQueue, error)
- func (sk *StakingPlugin) GetCandidateONRound(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) (staking.CandidateQueue, error)
- func (sk *StakingPlugin) GetDelegateExCompactInfo(blockHash common.Hash, blockNumber uint64, delAddr common.Address, ...) (*staking.DelegationEx, error)
- func (sk *StakingPlugin) GetDelegateInfo(blockHash common.Hash, delAddr common.Address, nodeId enode.IDv0, ...) (*staking.Delegation, error)
- func (sk *StakingPlugin) GetDelegatesInfo(blockHash common.Hash, delAddr common.Address) ([]*staking.DelegationInfo, error)
- func (sk *StakingPlugin) GetGetDelegationLockCompactInfo(blockHash common.Hash, blockNumber uint64, delAddr common.Address) (*staking.DelegationLockHex, error)
- func (sk *StakingPlugin) GetLastNumber(blockNumber uint64) uint64
- func (sk *StakingPlugin) GetRelatedListByDelAddr(blockHash common.Hash, addr common.Address) (staking.DelRelatedQueue, error)
- func (sk *StakingPlugin) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)
- func (sk *StakingPlugin) GetValidatorHistoryList(targetBlockNumber uint64) ([]*staking.HistoryValidatorEx, error)
- func (sk *StakingPlugin) GetValidatorList(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) (staking.ValidatorExQueue, error)
- func (sk *StakingPlugin) GetVerifierCandidateInfo(blockHash common.Hash, blockNumber uint64) ([]*staking.Candidate, error)
- func (sk *StakingPlugin) GetVerifierList(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.ValidatorExQueue, error)
- func (sk *StakingPlugin) HandleUnCandidateItem(state xcom.StateDB, blockNumber uint64, blockHash common.Hash, epoch uint64) error
- func (sk *StakingPlugin) HasStake(blockHash common.Hash, addr common.Address) (bool, error)
- func (sk *StakingPlugin) IncreaseStaking(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, ...) error
- func (sk *StakingPlugin) IsCandidate(blockHash common.Hash, nodeId enode.IDv0, isCommit bool) (bool, error)
- func (sk *StakingPlugin) IsCandidateNode(nodeID enode.IDv0) bool
- func (sk *StakingPlugin) IsCurrValidator(blockHash common.Hash, blockNumber uint64, nodeId enode.IDv0, isCommit bool) (bool, error)
- func (sk *StakingPlugin) IsCurrVerifier(blockHash common.Hash, blockNumber uint64, nodeId enode.IDv0, isCommit bool) (bool, error)
- func (sk *StakingPlugin) ListCurrentValidatorID(blockHash common.Hash, blockNumber uint64) ([]enode.IDv0, error)
- func (sk *StakingPlugin) ListVerifierNodeID(blockHash common.Hash, blockNumber uint64) ([]enode.IDv0, error)
- func (sk *StakingPlugin) ProposalPassedNotify(blockHash common.Hash, blockNumber uint64, nodeIds []enode.IDv0, ...) error
- func (sk *StakingPlugin) RedeemDelegation(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) (*big.Int, *big.Int, error)
- func (sk *StakingPlugin) RollBackStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) error
- func (sk *StakingPlugin) SetChainConfig(config *params.ChainConfig)
- func (sk *StakingPlugin) SetChainDB(reader ethdb.KeyValueReader, writer ethdb.KeyValueWriter)
- func (sk *StakingPlugin) SetEventMux(eventMux *event.TypeMux)
- func (sk *StakingPlugin) SlashCandidates(state xcom.StateDB, blockHash common.Hash, blockNumber uint64, ...) error
- func (sk *StakingPlugin) WithdrewDelegation(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, ...) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, error)
- func (sk *StakingPlugin) WithdrewStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, ...) error
- type WaitSlashingNode
Constants ¶
const ( LessThanFoundationYearDeveloperRate = 100 AfterFoundationYearDeveloperRewardRate = 50 AfterFoundationYearFoundRewardRate = 50 RewardPoolIncreaseRate = 80 // 80% of fixed-issued tokens are allocated to reward pool each year )
const ( HundredDenominator = 100 TenThousandDenominator = 10000 )
Variables ¶
Functions ¶
func AppendDelegateRewardPer ¶ added in v0.7.6
func AppendDelegateRewardPer(blockHash common.Hash, nodeID enode.IDv0, stakingNum uint64, per *reward.DelegateRewardPer, db snapshotdb.DB) error
func CheckOperatingThreshold ¶ added in v0.7.4
func CheckStakeThreshold ¶ added in v0.7.4
func GetBlockNumberByEpoch ¶
func GetHistoryCumulativeIssue ¶
GetHistoryCumulativeIssue used for get the cumulative issuance of a certain year in history
func LoadChainYearNumber ¶ added in v0.7.5
func LoadNewBlockReward ¶ added in v0.7.5
func LoadRemainingReward ¶ added in v0.7.5
func LoadStakingReward ¶ added in v0.7.5
func LoadYearStartTime ¶ added in v0.7.5
func SetYearEndCumulativeIssue ¶
SetYearEndCumulativeIssue used for set historical cumulative increase at the end of the year
func StorageChainYearNumber ¶ added in v0.7.5
func StorageNewBlockReward ¶ added in v0.7.5
func StorageRemainingReward ¶ added in v0.7.5
func StorageStakingReward ¶ added in v0.7.5
func StorageYearStartTime ¶ added in v0.7.5
func UpdateDelegateRewardPer ¶ added in v0.7.6
func UpdateDelegateRewardPer(blockHash common.Hash, nodeID enode.IDv0, stakingNum uint64, receives []reward.DelegateRewardReceipt, db snapshotdb.DB) error
Types ¶
type BasePlugin ¶
type DelegationInfoWithRewardPerList ¶ added in v0.7.6
type DelegationInfoWithRewardPerList struct { DelegationInfo *staking.DelegationInfo RewardPerList []*reward.DelegateRewardPer }
func NewDelegationInfoWithRewardPerList ¶ added in v0.7.6
func NewDelegationInfoWithRewardPerList(delegationInfo *staking.DelegationInfo, rewardPerList []*reward.DelegateRewardPer) *DelegationInfoWithRewardPerList
func (*DelegationInfoWithRewardPerList) String ¶ added in v0.7.6
func (d *DelegationInfoWithRewardPerList) String() string
type GovPlugin ¶
type GovPlugin struct {
// contains filtered or unexported fields
}
func GovPluginInstance ¶
func GovPluginInstance() *GovPlugin
func (*GovPlugin) BeginBlock ¶
func (govPlugin *GovPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
implement BasePlugin
func (*GovPlugin) EndBlock ¶
func (govPlugin *GovPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
implement BasePlugin
func (*GovPlugin) SetChainDB ¶ added in v1.3.0
func (*GovPlugin) SetChainID ¶ added in v1.0.0
type PublicPPOSAPI ¶ added in v1.0.0
type PublicPPOSAPI struct {
// contains filtered or unexported fields
}
Provides an API interface to obtain data related to the economic model
func NewPublicPPOSAPI ¶ added in v1.0.0
func NewPublicPPOSAPI() *PublicPPOSAPI
func (*PublicPPOSAPI) GetValidatorByBlockNumber ¶ added in v1.4.0
func (p *PublicPPOSAPI) GetValidatorByBlockNumber(ctx context.Context, blockNumber uint64) string
func (*PublicPPOSAPI) GetWaitSlashingNodeList ¶ added in v1.0.0
func (p *PublicPPOSAPI) GetWaitSlashingNodeList() string
Get node list of zero-out blocks
type RestrictingPlugin ¶
type RestrictingPlugin struct {
// contains filtered or unexported fields
}
func NewRestrictingPlugin ¶ added in v1.0.0
func NewRestrictingPlugin(snapdb snapshotdb.DB) *RestrictingPlugin
func RestrictingInstance ¶
func RestrictingInstance() *RestrictingPlugin
func (*RestrictingPlugin) AddRestrictingRecord ¶
func (rp *RestrictingPlugin) AddRestrictingRecord(from, account common.Address, blockNum uint64, blockHash common.Hash, plans []restricting.RestrictingPlan, state xcom.StateDB, txhash common.Hash) error
AddRestrictingRecord stores four K-V record in StateDB: RestrictingInfo: the account info to be released ReleaseEpoch: the number of accounts to be released on the epoch corresponding to the target block height ReleaseAccount: the account on the index on the target epoch ReleaseAmount: the amount of the account to be released on the target epoch
func (*RestrictingPlugin) AdvanceLockedFunds ¶ added in v1.0.0
func (rp *RestrictingPlugin) AdvanceLockedFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
AdvanceLockedFunds transfer the money from the restricting contract account to the staking contract account
func (*RestrictingPlugin) BeginBlock ¶
func (rp *RestrictingPlugin) BeginBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
BeginBlock does something like check input params before execute transactions, in RestrictingPlugin it does nothing.
func (*RestrictingPlugin) EndBlock ¶
func (rp *RestrictingPlugin) EndBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
EndBlock invoke releaseRestricting
func (*RestrictingPlugin) GetRestrictingInfo ¶
func (rp *RestrictingPlugin) GetRestrictingInfo(account common.Address, state xcom.StateDB) (*restricting.Result, *common.BizError)
func (*RestrictingPlugin) InitGenesisRestrictingPlans ¶ added in v0.7.5
func (rp *RestrictingPlugin) InitGenesisRestrictingPlans(statedb xcom.StateDB) error
init the genesis restricting plans
func (*RestrictingPlugin) MixAdvanceLockedFunds ¶ added in v1.0.0
func (rp *RestrictingPlugin) MixAdvanceLockedFunds(account common.Address, amount *big.Int, state xcom.StateDB) (*big.Int, *big.Int, error)
MixAdvanceLockedFunds transfer the money from the restricting contract account to the staking contract account,use restricting von first,if restricting not en
func (*RestrictingPlugin) ReturnLockFunds ¶
func (rp *RestrictingPlugin) ReturnLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error
ReturnLockFunds transfer the money from the staking contract account to the restricting contract account
func (*RestrictingPlugin) SlashingNotify ¶
func (rp *RestrictingPlugin) SlashingNotify(account common.Address, amount *big.Int, state xcom.StateDB) error
SlashingNotify modify Debt of restricting account
type RewardMgrPlugin ¶ added in v0.7.3
type RewardMgrPlugin struct {
// contains filtered or unexported fields
}
func RewardMgrInstance ¶
func RewardMgrInstance() *RewardMgrPlugin
func (*RewardMgrPlugin) AllocatePackageBlock ¶ added in v0.7.6
func (rmp *RewardMgrPlugin) AllocatePackageBlock(blockHash common.Hash, head *types.Header, reward *big.Int, state xcom.StateDB) error
AllocatePackageBlock used for reward new block. it returns coinbase and error
func (*RewardMgrPlugin) AllocateStakingReward ¶ added in v0.7.6
func (rmp *RewardMgrPlugin) AllocateStakingReward(blockNumber uint64, blockHash common.Hash, sreward *big.Int, state xcom.StateDB) ([]*staking.Candidate, error)
AllocateStakingReward used for reward staking at the settle block
func (*RewardMgrPlugin) BeginBlock ¶ added in v0.7.3
func (rmp *RewardMgrPlugin) BeginBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
BeginBlock does something like check input params before execute transactions, in RewardMgrPlugin it does nothing.
func (*RewardMgrPlugin) CalDelegateRewardAndNodeReward ¶ added in v0.7.6
func (*RewardMgrPlugin) CalcEpochReward ¶ added in v0.7.5
func (*RewardMgrPlugin) EndBlock ¶ added in v0.7.3
func (rmp *RewardMgrPlugin) EndBlock(blockHash common.Hash, head *types.Header, state xcom.StateDB) error
EndBlock will handle reward work, if it's time to settle, reward staking. Then reward worker for create new block, this is necessary. At last if current block is the last block at the end of year, increasing issuance.
func (*RewardMgrPlugin) GetDelegateReward ¶ added in v0.7.6
func (*RewardMgrPlugin) GetDelegateRewardPerList ¶ added in v0.7.6
func (rmp *RewardMgrPlugin) GetDelegateRewardPerList(blockHash common.Hash, nodeID enode.IDv0, stakingNum, fromEpoch, toEpoch uint64) ([]*reward.DelegateRewardPer, error)
func (*RewardMgrPlugin) HandleDelegatePerReward ¶ added in v0.7.6
func (*RewardMgrPlugin) ReturnDelegateReward ¶ added in v0.7.6
func (*RewardMgrPlugin) SetCurrentNodeID ¶ added in v0.7.6
func (rmp *RewardMgrPlugin) SetCurrentNodeID(nodeId enode.IDv0)
func (*RewardMgrPlugin) WithdrawDelegateReward ¶ added in v0.7.6
func (rmp *RewardMgrPlugin) WithdrawDelegateReward(blockHash common.Hash, blockNum uint64, account common.Address, list []*DelegationInfoWithRewardPerList, state xcom.StateDB, rules params.Rules) ([]reward.NodeDelegateReward, error)
type SlashingPlugin ¶
type SlashingPlugin struct {
// contains filtered or unexported fields
}
func SlashInstance ¶
func SlashInstance() *SlashingPlugin
func (*SlashingPlugin) BeginBlock ¶
func (*SlashingPlugin) CheckDuplicateSign ¶
func (sp *SlashingPlugin) CheckDuplicateSign(nodeId enode.IDv0, blockNumber uint64, dupType consensus.EvidenceType, stateDB xcom.StateDB) ([]byte, error)
func (*SlashingPlugin) DecodeEvidence ¶
func (sp *SlashingPlugin) DecodeEvidence(dupType consensus.EvidenceType, data string) (consensus.Evidence, error)
func (*SlashingPlugin) GetPrePackAmount ¶ added in v0.7.3
func (sp *SlashingPlugin) GetPrePackAmount(blockNumber uint64, parentHash common.Hash) (map[enode.IDv0]uint32, error)
Get the consensus rate of all nodes in the previous round
func (*SlashingPlugin) SetDecodeEvidenceFun ¶
func (sp *SlashingPlugin) SetDecodeEvidenceFun(f func(dupType consensus.EvidenceType, data string) (consensus.Evidence, error))
func (*SlashingPlugin) SetPrivateKey ¶
func (sp *SlashingPlugin) SetPrivateKey(privateKey *ecdsa.PrivateKey)
type StakingPlugin ¶
type StakingPlugin struct {
// contains filtered or unexported fields
}
func NewStakingPlugin ¶ added in v1.0.0
func NewStakingPlugin(db snapshotdb.DB) *StakingPlugin
func (*StakingPlugin) AdvanceDelegationLockedFunds ¶ added in v1.3.0
func (sk *StakingPlugin) AdvanceDelegationLockedFunds(blockHash common.Hash, account common.Address, currentEpoch uint32, amount *big.Int) (*big.Int, *big.Int, error)
AdvanceDelegationLockedFunds 使用处于锁定期的委托金去重新委托
func (*StakingPlugin) BeginBlock ¶
func (*StakingPlugin) CreateCandidate ¶
func (*StakingPlugin) DeclarePromoteNotify ¶
func (*StakingPlugin) Delegate ¶
func (sk *StakingPlugin) Delegate(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, delAddr common.Address, del *staking.Delegation, canAddr common.NodeAddress, can *staking.Candidate, typ uint16, amount *big.Int, delegateRewardPerList []*reward.DelegateRewardPer, isEinstein bool) error
func (*StakingPlugin) EditCandidate ¶
func (sk *StakingPlugin) EditCandidate(blockHash common.Hash, blockNumber *big.Int, canAddr common.NodeAddress, can *staking.Candidate) error
func (*StakingPlugin) ElectNextVerifierList ¶
func (*StakingPlugin) EnableValidatorsHistory ¶ added in v1.4.0
func (sk *StakingPlugin) EnableValidatorsHistory()
func (*StakingPlugin) GetCanBase ¶ added in v0.7.4
func (sk *StakingPlugin) GetCanBase(blockHash common.Hash, addr common.NodeAddress) (*staking.CandidateBase, error)
func (*StakingPlugin) GetCanBaseByIrr ¶ added in v0.7.4
func (sk *StakingPlugin) GetCanBaseByIrr(addr common.NodeAddress) (*staking.CandidateBase, error)
func (*StakingPlugin) GetCanBaseList ¶ added in v0.7.4
func (sk *StakingPlugin) GetCanBaseList(blockHash common.Hash, blockNumber uint64) (staking.CandidateBaseQueue, error)
func (*StakingPlugin) GetCanMutable ¶ added in v0.7.4
func (sk *StakingPlugin) GetCanMutable(blockHash common.Hash, addr common.NodeAddress) (*staking.CandidateMutable, error)
func (*StakingPlugin) GetCanMutableByIrr ¶ added in v0.7.4
func (sk *StakingPlugin) GetCanMutableByIrr(addr common.NodeAddress) (*staking.CandidateMutable, error)
func (*StakingPlugin) GetCandidateCompactInfo ¶
func (sk *StakingPlugin) GetCandidateCompactInfo(blockHash common.Hash, blockNumber uint64, addr common.NodeAddress) (*staking.CandidateHex, error)
func (*StakingPlugin) GetCandidateInfo ¶
func (sk *StakingPlugin) GetCandidateInfo(blockHash common.Hash, addr common.NodeAddress) (*staking.Candidate, error)
func (*StakingPlugin) GetCandidateInfoByIrr ¶
func (sk *StakingPlugin) GetCandidateInfoByIrr(addr common.NodeAddress) (*staking.Candidate, error)
func (*StakingPlugin) GetCandidateList ¶
func (sk *StakingPlugin) GetCandidateList(blockHash common.Hash, blockNumber uint64) (staking.CandidateHexQueue, error)
func (*StakingPlugin) GetCandidateONEpoch ¶
func (sk *StakingPlugin) GetCandidateONEpoch(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.CandidateQueue, error)
func (*StakingPlugin) GetCandidateONRound ¶
func (sk *StakingPlugin) GetCandidateONRound(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) (staking.CandidateQueue, error)
func (*StakingPlugin) GetDelegateExCompactInfo ¶
func (*StakingPlugin) GetDelegateInfo ¶
func (*StakingPlugin) GetDelegatesInfo ¶ added in v0.7.6
func (sk *StakingPlugin) GetDelegatesInfo(blockHash common.Hash, delAddr common.Address) ([]*staking.DelegationInfo, error)
func (*StakingPlugin) GetGetDelegationLockCompactInfo ¶ added in v1.3.0
func (sk *StakingPlugin) GetGetDelegationLockCompactInfo(blockHash common.Hash, blockNumber uint64, delAddr common.Address) (*staking.DelegationLockHex, error)
func (*StakingPlugin) GetLastNumber ¶
func (sk *StakingPlugin) GetLastNumber(blockNumber uint64) uint64
func (*StakingPlugin) GetRelatedListByDelAddr ¶
func (sk *StakingPlugin) GetRelatedListByDelAddr(blockHash common.Hash, addr common.Address) (staking.DelRelatedQueue, error)
func (*StakingPlugin) GetValidator ¶
func (sk *StakingPlugin) GetValidator(blockNumber uint64) (*cbfttypes.Validators, error)
func (*StakingPlugin) GetValidatorHistoryList ¶ added in v1.4.0
func (sk *StakingPlugin) GetValidatorHistoryList(targetBlockNumber uint64) ([]*staking.HistoryValidatorEx, error)
Get the list of consensus nodes for a given consensus round.
func (*StakingPlugin) GetValidatorList ¶
func (sk *StakingPlugin) GetValidatorList(blockHash common.Hash, blockNumber uint64, flag uint, isCommit bool) ( staking.ValidatorExQueue, error)
flag:NOTE 0: Query previous round consensus validator 1: Query current round consensus validaor 2: Query next round consensus validator
func (*StakingPlugin) GetVerifierCandidateInfo ¶ added in v0.7.6
func (*StakingPlugin) GetVerifierList ¶
func (sk *StakingPlugin) GetVerifierList(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.ValidatorExQueue, error)
func (*StakingPlugin) HandleUnCandidateItem ¶
func (*StakingPlugin) IncreaseStaking ¶
func (*StakingPlugin) IsCandidate ¶
func (*StakingPlugin) IsCandidateNode ¶
func (sk *StakingPlugin) IsCandidateNode(nodeID enode.IDv0) bool
NOTE: Verify that it is the validator of the current Epoch
func (*StakingPlugin) IsCurrValidator ¶
func (*StakingPlugin) IsCurrVerifier ¶
func (*StakingPlugin) ListCurrentValidatorID ¶
func (*StakingPlugin) ListVerifierNodeID ¶
func (*StakingPlugin) ProposalPassedNotify ¶
func (*StakingPlugin) RedeemDelegation ¶ added in v1.3.0
func (*StakingPlugin) RollBackStaking ¶
func (sk *StakingPlugin) RollBackStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int, addr common.NodeAddress, typ uint16) error
This method may only be called when creatStaking
func (*StakingPlugin) SetChainConfig ¶ added in v1.4.1
func (sk *StakingPlugin) SetChainConfig(config *params.ChainConfig)
func (*StakingPlugin) SetChainDB ¶ added in v1.4.0
func (sk *StakingPlugin) SetChainDB(reader ethdb.KeyValueReader, writer ethdb.KeyValueWriter)
func (*StakingPlugin) SetEventMux ¶
func (sk *StakingPlugin) SetEventMux(eventMux *event.TypeMux)
func (*StakingPlugin) SlashCandidates ¶
func (sk *StakingPlugin) SlashCandidates(state xcom.StateDB, blockHash common.Hash, blockNumber uint64, queue ...*staking.SlashNodeItem) error
NotifyPunishedVerifiers
func (*StakingPlugin) WithdrewDelegation ¶ added in v1.1.0
func (sk *StakingPlugin) WithdrewDelegation(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int, delAddr common.Address, nodeId enode.IDv0, stakingBlockNum uint64, del *staking.Delegation, delegateRewardPerList []*reward.DelegateRewardPer, isEinstein bool) (*big.Int, *big.Int, *big.Int, *big.Int, *big.Int, error)
func (*StakingPlugin) WithdrewStaking ¶
type WaitSlashingNode ¶ added in v1.0.0
type WaitSlashingNode struct { NodeId enode.IDv0 // The number of consensus rounds when the first zero block appeared Round uint64 // Used to record the number of times the node has zero blocks. // Each bit represents whether each consensus round is zero block. CountBit uint64 }
Nodes with zero blocks will construct this structure and store it in the queue waiting for punishment.
func (*WaitSlashingNode) String ¶ added in v1.0.0
func (w *WaitSlashingNode) String() string