plugin

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LessThanFoundationYearDeveloperRate    = 100
	AfterFoundationYearDeveloperRewardRate = 10
	AfterFoundationYearFoundRewardRate     = 50
	RewardPoolIncreaseRate                 = 40 // 40% of fixed-issued tokens are allocated to reward pool each year

)
View Source
const (
	HundredDenominator     = 100
	TenThousandDenominator = 10000
)
View Source
const (
	FreeVon            = uint16(0)
	RestrictVon        = uint16(1)
	RestrictAndFreeVon = uint16(2)

	PreviousRound = uint(0)
	CurrentRound  = uint(1)
	NextRound     = uint(2)

	QueryStartIrr    = true
	QueryStartNotIrr = false

	EpochValIndexSize = 2
	RoundValIndexSize = 6
)

Variables

View Source
var (
	DecodeTxDataErr = errors.New("decode tx data is err")
	FuncNotExistErr = errors.New("the func is not exist")
	FnParamsLenErr  = errors.New("the params len and func params len is not equal")
)

Functions

func AppendDelegateRewardPer

func AppendDelegateRewardPer(blockHash common.Hash, nodeID discover.NodeID, stakingNum uint64, per *reward.DelegateRewardPer, db snapshotdb.DB) error

func CheckOperatingThreshold

func CheckOperatingThreshold(blockNumber uint64, blockHash common.Hash, balance *big.Int) (bool, *big.Int)

func CheckStakeThreshold

func CheckStakeThreshold(blockNumber uint64, blockHash common.Hash, stake *big.Int) (bool, *big.Int)

func Decimal

func Decimal(value float64) int

func GetBlockNumberByEpoch

func GetBlockNumberByEpoch(epoch uint64) uint64

func GetHistoryCumulativeIssue

func GetHistoryCumulativeIssue(state xcom.StateDB, year uint32) *big.Int

GetHistoryCumulativeIssue used for get the cumulative issuance of a certain year in history

func GetYearEndBalance

func GetYearEndBalance(state xcom.StateDB, year uint32) *big.Int

func LoadChainYearNumber

func LoadChainYearNumber(hash common.Hash, snapshotDB snapshotdb.DB) (uint32, error)

func LoadNewBlockReward

func LoadNewBlockReward(hash common.Hash, snapshotDB snapshotdb.DB) (*big.Int, error)

func LoadRemainingReward

func LoadRemainingReward(hash common.Hash, snapshotDB snapshotdb.DB) (*big.Int, error)

func LoadStakingReward

func LoadStakingReward(hash common.Hash, snapshotDB snapshotdb.DB) (*big.Int, error)

func LoadYearStartTime

func LoadYearStartTime(hash common.Hash, snapshotDB snapshotdb.DB) (yearStartBlockNumber uint64, yearStartTime int64, error error)

func NewIssue1625Accounts

func NewIssue1625Accounts() ([]issue1625Accounts, error)

func NewIssue1654Candidates

func NewIssue1654Candidates() ([]issue1654Candidate, error)

func SetYearEndBalance

func SetYearEndBalance(state xcom.StateDB, year uint32, balance *big.Int)

func SetYearEndCumulativeIssue

func SetYearEndCumulativeIssue(state xcom.StateDB, year uint32, total *big.Int)

SetYearEndCumulativeIssue used for set historical cumulative increase at the end of the year

func StorageChainYearNumber

func StorageChainYearNumber(hash common.Hash, snapshotDB snapshotdb.DB, yearNumber uint32) error

func StorageNewBlockReward

func StorageNewBlockReward(hash common.Hash, snapshotDB snapshotdb.DB, newBlockReward *big.Int) error

func StorageRemainingReward

func StorageRemainingReward(hash common.Hash, snapshotDB snapshotdb.DB, remainReward *big.Int) error

func StorageStakingReward

func StorageStakingReward(hash common.Hash, snapshotDB snapshotdb.DB, stakingReward *big.Int) error

func StorageYearStartTime

func StorageYearStartTime(hash common.Hash, snapshotDB snapshotdb.DB, blockNumber uint64, yearStartTime int64) error

func UpdateDelegateRewardPer

func UpdateDelegateRewardPer(blockHash common.Hash, nodeID discover.NodeID, stakingNum uint64, receives []reward.DelegateRewardReceipt, db snapshotdb.DB) error

func VerifyTxData

func VerifyTxData(input []byte, command map[uint16]interface{}) (cnCode uint16, fn interface{}, FnParams []reflect.Value, err error)

Types

type BasePlugin

type BasePlugin interface {
	BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
	EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error
	Confirmed(nodeId discover.NodeID, block *types.Block) error
}

type DelegationInfoWithRewardPerList

type DelegationInfoWithRewardPerList struct {
	DelegationInfo *staking.DelegationInfo
	RewardPerList  []*reward.DelegateRewardPer
}

func NewDelegationInfoWithRewardPerList

func NewDelegationInfoWithRewardPerList(delegationInfo *staking.DelegationInfo, rewardPerList []*reward.DelegateRewardPer) *DelegationInfoWithRewardPerList

func (*DelegationInfoWithRewardPerList) String

type FixIssue1583Plugin

type FixIssue1583Plugin struct{}

func NewFixIssue1583Plugin

func NewFixIssue1583Plugin() *FixIssue1583Plugin

给没有领取委托奖励的账户平账 , https://github.com/PlatONnetwork/PlatON-Go/issues/1583

type FixIssue1625Plugin

type FixIssue1625Plugin struct {
	// contains filtered or unexported fields
}

func NewFixIssue1625Plugin

func NewFixIssue1625Plugin(sdb snapshotdb.DB) *FixIssue1625Plugin

type FixIssue1654Plugin

type FixIssue1654Plugin struct {
	// contains filtered or unexported fields
}

func NewFixIssue1654Plugin

func NewFixIssue1654Plugin(sdb snapshotdb.DB) *FixIssue1654Plugin

this is use fix validators staking shares error, https://github.com/PlatONnetwork/PlatON-Go/issues/1654

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

func (govPlugin *GovPlugin) Confirmed(nodeId discover.NodeID, block *types.Block) error

func (*GovPlugin) EndBlock

func (govPlugin *GovPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error

implement BasePlugin

func (*GovPlugin) SetChainID

func (govPlugin *GovPlugin) SetChainID(chainId *big.Int)

type PublicPPOSAPI

type PublicPPOSAPI struct {
	// contains filtered or unexported fields
}

Provides an API interface to obtain data related to the economic model

func NewPublicPPOSAPI

func NewPublicPPOSAPI() *PublicPPOSAPI

func (*PublicPPOSAPI) GetWaitSlashingNodeList

func (p *PublicPPOSAPI) GetWaitSlashingNodeList() string

Get node list of zero-out blocks

type RestrictingPlugin

type RestrictingPlugin struct {
	// contains filtered or unexported fields
}

func NewRestrictingPlugin

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

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

func (rp *RestrictingPlugin) Confirmed(nodeId discover.NodeID, block *types.Block) error

Confirmed is empty function

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

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

func (rp *RestrictingPlugin) ReturnWrongLockFunds(account common.Address, amount *big.Int, state xcom.StateDB) error

ReturnWrongLockFunds 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

type RewardMgrPlugin struct {
	// contains filtered or unexported fields
}

func RewardMgrInstance

func RewardMgrInstance() *RewardMgrPlugin

func (*RewardMgrPlugin) AllocatePackageBlock

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

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

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

func (rmp *RewardMgrPlugin) CalDelegateRewardAndNodeReward(totalReward *big.Int, per uint16) (*big.Int, *big.Int)

func (*RewardMgrPlugin) CalcEpochReward

func (rmp *RewardMgrPlugin) CalcEpochReward(blockHash common.Hash, head *types.Header, state xcom.StateDB) (*big.Int, *big.Int, error)

func (*RewardMgrPlugin) Confirmed

func (rmp *RewardMgrPlugin) Confirmed(nodeId discover.NodeID, block *types.Block) error

Confirmed does nothing

func (*RewardMgrPlugin) EndBlock

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

func (rmp *RewardMgrPlugin) GetDelegateReward(blockHash common.Hash, blockNum uint64, account common.Address, nodes []discover.NodeID, state xcom.StateDB) ([]reward.NodeDelegateRewardPresenter, error)

func (*RewardMgrPlugin) GetDelegateRewardPerList

func (rmp *RewardMgrPlugin) GetDelegateRewardPerList(blockHash common.Hash, nodeID discover.NodeID, stakingNum, fromEpoch, toEpoch uint64) ([]*reward.DelegateRewardPer, error)

func (*RewardMgrPlugin) HandleDelegatePerReward

func (rmp *RewardMgrPlugin) HandleDelegatePerReward(blockHash common.Hash, blockNumber uint64, list []*staking.Candidate, state xcom.StateDB) error

func (*RewardMgrPlugin) ReturnDelegateReward

func (rmp *RewardMgrPlugin) ReturnDelegateReward(address common.Address, amount *big.Int, state xcom.StateDB) error

func (*RewardMgrPlugin) SetCurrentNodeID

func (rmp *RewardMgrPlugin) SetCurrentNodeID(nodeId discover.NodeID)

func (*RewardMgrPlugin) WithdrawDelegateReward

func (rmp *RewardMgrPlugin) WithdrawDelegateReward(blockHash common.Hash, blockNum uint64, account common.Address, list []*DelegationInfoWithRewardPerList, state xcom.StateDB) ([]reward.NodeDelegateReward, error)

type SlashingPlugin

type SlashingPlugin struct {
	// contains filtered or unexported fields
}

func SlashInstance

func SlashInstance() *SlashingPlugin

func (*SlashingPlugin) BeginBlock

func (sp *SlashingPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error

func (*SlashingPlugin) CheckDuplicateSign

func (sp *SlashingPlugin) CheckDuplicateSign(nodeId discover.NodeID, blockNumber uint64, dupType consensus.EvidenceType, stateDB xcom.StateDB) ([]byte, error)

func (*SlashingPlugin) Confirmed

func (sp *SlashingPlugin) Confirmed(nodeId discover.NodeID, block *types.Block) error

func (*SlashingPlugin) DecodeEvidence

func (sp *SlashingPlugin) DecodeEvidence(dupType consensus.EvidenceType, data string) (consensus.Evidence, error)

func (*SlashingPlugin) EndBlock

func (sp *SlashingPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error

func (*SlashingPlugin) GetPrePackAmount

func (sp *SlashingPlugin) GetPrePackAmount(blockNumber uint64, parentHash common.Hash) (map[discover.NodeID]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)

func (*SlashingPlugin) Slash

func (sp *SlashingPlugin) Slash(evidence consensus.Evidence, blockHash common.Hash, blockNumber uint64, stateDB xcom.StateDB, caller common.Address) error

type StakingPlugin

type StakingPlugin struct {
	// contains filtered or unexported fields
}

func NewStakingPlugin

func NewStakingPlugin(db snapshotdb.DB) *StakingPlugin

func StakingInstance

func StakingInstance() *StakingPlugin

Instance a global StakingPlugin

func (*StakingPlugin) BeginBlock

func (sk *StakingPlugin) BeginBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error

func (*StakingPlugin) Confirmed

func (sk *StakingPlugin) Confirmed(nodeId discover.NodeID, block *types.Block) error

func (*StakingPlugin) CreateCandidate

func (sk *StakingPlugin) CreateCandidate(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int,
	typ uint16, addr common.NodeAddress, can *staking.Candidate) error

func (*StakingPlugin) DeclarePromoteNotify

func (sk *StakingPlugin) DeclarePromoteNotify(blockHash common.Hash, blockNumber uint64, nodeId discover.NodeID,
	programVersion uint32) error

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) 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 (sk *StakingPlugin) ElectNextVerifierList(blockHash common.Hash, blockNumber uint64, state xcom.StateDB) error

func (*StakingPlugin) Election

func (sk *StakingPlugin) Election(blockHash common.Hash, header *types.Header, state xcom.StateDB) error

func (*StakingPlugin) EndBlock

func (sk *StakingPlugin) EndBlock(blockHash common.Hash, header *types.Header, state xcom.StateDB) error

func (*StakingPlugin) GetCanBase

func (sk *StakingPlugin) GetCanBase(blockHash common.Hash, addr common.NodeAddress) (*staking.CandidateBase, error)

func (*StakingPlugin) GetCanBaseByIrr

func (sk *StakingPlugin) GetCanBaseByIrr(addr common.NodeAddress) (*staking.CandidateBase, error)

func (*StakingPlugin) GetCanBaseList

func (sk *StakingPlugin) GetCanBaseList(blockHash common.Hash, blockNumber uint64) (staking.CandidateBaseQueue, error)

func (*StakingPlugin) GetCanMutable

func (sk *StakingPlugin) GetCanMutable(blockHash common.Hash, addr common.NodeAddress) (*staking.CandidateMutable, error)

func (*StakingPlugin) GetCanMutableByIrr

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 (sk *StakingPlugin) GetDelegateExCompactInfo(blockHash common.Hash, blockNumber uint64, delAddr common.Address,
	nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.DelegationEx, error)

func (*StakingPlugin) GetDelegateExInfo

func (sk *StakingPlugin) GetDelegateExInfo(blockHash common.Hash, delAddr common.Address,
	nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.DelegationEx, error)

func (*StakingPlugin) GetDelegateExInfoByIrr

func (sk *StakingPlugin) GetDelegateExInfoByIrr(delAddr common.Address,
	nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.DelegationEx, error)

func (*StakingPlugin) GetDelegateInfo

func (sk *StakingPlugin) GetDelegateInfo(blockHash common.Hash, delAddr common.Address,
	nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.Delegation, error)

func (*StakingPlugin) GetDelegateInfoByIrr

func (sk *StakingPlugin) GetDelegateInfoByIrr(delAddr common.Address,
	nodeId discover.NodeID, stakeBlockNumber uint64) (*staking.Delegation, error)

func (*StakingPlugin) GetDelegatesInfo

func (sk *StakingPlugin) GetDelegatesInfo(blockHash common.Hash, delAddr common.Address) ([]*staking.DelegationInfo, 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) 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

func (sk *StakingPlugin) GetVerifierCandidateInfo(blockHash common.Hash, blockNumber uint64) ([]*staking.Candidate, error)

func (*StakingPlugin) GetVerifierList

func (sk *StakingPlugin) GetVerifierList(blockHash common.Hash, blockNumber uint64, isCommit bool) (staking.ValidatorExQueue, error)

func (*StakingPlugin) HandleUnCandidateItem

func (sk *StakingPlugin) HandleUnCandidateItem(state xcom.StateDB, blockNumber uint64, blockHash common.Hash, epoch uint64) error

func (*StakingPlugin) HasStake

func (sk *StakingPlugin) HasStake(blockHash common.Hash, addr common.Address) (bool, error)

func (*StakingPlugin) IncreaseStaking

func (sk *StakingPlugin) IncreaseStaking(state xcom.StateDB, blockHash common.Hash, blockNumber,
	amount *big.Int, typ uint16, canAddr common.NodeAddress, can *staking.Candidate) error

func (*StakingPlugin) IsCandidate

func (sk *StakingPlugin) IsCandidate(blockHash common.Hash, nodeId discover.NodeID, isCommit bool) (bool, error)

func (*StakingPlugin) IsCandidateNode

func (sk *StakingPlugin) IsCandidateNode(nodeID discover.NodeID) bool

NOTE: Verify that it is the validator of the current Epoch

func (*StakingPlugin) IsCurrValidator

func (sk *StakingPlugin) IsCurrValidator(blockHash common.Hash, blockNumber uint64, nodeId discover.NodeID, isCommit bool) (bool, error)

func (*StakingPlugin) IsCurrVerifier

func (sk *StakingPlugin) IsCurrVerifier(blockHash common.Hash, blockNumber uint64, nodeId discover.NodeID, isCommit bool) (bool, error)

func (*StakingPlugin) ListCurrentValidatorID

func (sk *StakingPlugin) ListCurrentValidatorID(blockHash common.Hash, blockNumber uint64) ([]discover.NodeID, error)

func (*StakingPlugin) ListVerifierNodeID

func (sk *StakingPlugin) ListVerifierNodeID(blockHash common.Hash, blockNumber uint64) ([]discover.NodeID, error)

func (*StakingPlugin) ProposalPassedNotify

func (sk *StakingPlugin) ProposalPassedNotify(blockHash common.Hash, blockNumber uint64, nodeIds []discover.NodeID,
	programVersion uint32, state xcom.StateDB) error

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

func (sk *StakingPlugin) WithdrewDelegation(state xcom.StateDB, blockHash common.Hash, blockNumber, amount *big.Int,
	delAddr common.Address, nodeId discover.NodeID, stakingBlockNum uint64, del *staking.Delegation, delegateRewardPerList []*reward.DelegateRewardPer) (*big.Int, error)

func (*StakingPlugin) WithdrewStaking

func (sk *StakingPlugin) WithdrewStaking(state xcom.StateDB, blockHash common.Hash, blockNumber *big.Int,
	canAddr common.NodeAddress, can *staking.Candidate) error

type WaitSlashingNode

type WaitSlashingNode struct {
	NodeId discover.NodeID
	// 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

func (w *WaitSlashingNode) String() string

Jump to

Keyboard shortcuts

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