Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func UseLogger(logger elalog.Logger)
- type BudgetStatus
- type CRMember
- type Candidate
- func (c *Candidate) CancelHeight() uint32
- func (c *Candidate) Deserialize(r io.Reader) (err error)
- func (c *Candidate) Info() payload.CRInfo
- func (c *Candidate) RegisterHeight() uint32
- func (c *Candidate) Serialize(w io.Writer) (err error)
- func (c *Candidate) State() CandidateState
- func (c *Candidate) Votes() common.Fixed64
- type CandidateState
- type Checkpoint
- func (c *Checkpoint) DataExtension() string
- func (c *Checkpoint) Deserialize(r io.Reader) (err error)
- func (c *Checkpoint) EffectivePeriod() uint32
- func (c *Checkpoint) Generator() func(buf []byte) checkpoint.ICheckPoint
- func (c *Checkpoint) GetHeight() uint32
- func (c *Checkpoint) Key() string
- func (c *Checkpoint) LogError(err error)
- func (c *Checkpoint) OnBlockSaved(block *types.DposBlock)
- func (c *Checkpoint) OnInit()
- func (c *Checkpoint) OnRollbackSeekTo(height uint32)
- func (c *Checkpoint) OnRollbackTo(height uint32) error
- func (c *Checkpoint) Priority() checkpoint.Priority
- func (c *Checkpoint) SavePeriod() uint32
- func (c *Checkpoint) Serialize(w io.Writer) (err error)
- func (c *Checkpoint) SetHeight(height uint32)
- func (c *Checkpoint) Snapshot() checkpoint.ICheckPoint
- func (c *Checkpoint) StartHeight() uint32
- type Committee
- func (c *Committee) AvailableWithdrawalAmount(hash common.Uint256) common.Fixed64
- func (c *Committee) Exist(cid common.Uint168) bool
- func (c *Committee) ExistCR(programCode []byte) bool
- func (c *Committee) ExistCandidateByDepositHash(hash common.Uint168) bool
- func (c *Committee) ExistCandidateByNickname(nickname string) bool
- func (c *Committee) ExistDraft(hash common.Uint256) bool
- func (c *Committee) ExistProposal(hash common.Uint256) bool
- func (c *Committee) GetAllCandidates() []*Candidate
- func (c *Committee) GetAllMembers() []*CRMember
- func (c *Committee) GetAllMembersCopy() []*CRMember
- func (c *Committee) GetAllProposals() ProposalsMap
- func (c *Committee) GetAllRegisteredSideChain() map[uint32]map[common.Uint256]payload.SideChainInfo
- func (c *Committee) GetAvailableDepositAmount(cid common.Uint168) common.Fixed64
- func (c *Committee) GetCROnDutyPeriod() uint32
- func (c *Committee) GetCROnDutyStartHeight() uint32
- func (c *Committee) GetCRVotingPeriod() uint32
- func (c *Committee) GetCRVotingStartHeight() uint32
- func (c *Committee) GetCandidate(cid common.Uint168) *Candidate
- func (c *Committee) GetCandidateByCID(cid common.Uint168) *Candidate
- func (c *Committee) GetCandidateByID(id common.Uint168) *Candidate
- func (c *Committee) GetCandidateByPublicKey(publicKey string) *Candidate
- func (c *Committee) GetCandidates(state CandidateState) []*Candidate
- func (c *Committee) GetCommitteeCanUseAmount() common.Fixed64
- func (c *Committee) GetCustomIDResults() []payload.ProposalResult
- func (c *Committee) GetDepositAmountByID(id common.Uint168) (common.Fixed64, common.Fixed64, common.Fixed64, common.Fixed64, error)
- func (c *Committee) GetDepositAmountByPublicKey(publicKey string) (common.Fixed64, common.Fixed64, common.Fixed64, common.Fixed64, error)
- func (c *Committee) GetElectedMembers() []*CRMember
- func (c *Committee) GetImpeachableMembers() []*CRMember
- func (c *Committee) GetMember(did common.Uint168) *CRMember
- func (c *Committee) GetMemberByNodePublicKey(nodePK []byte) *CRMember
- func (c *Committee) GetMembersCodes() [][]byte
- func (c *Committee) GetMembersDIDs() []common.Uint168
- func (c *Committee) GetPenalty(cid common.Uint168) common.Fixed64
- func (c *Committee) GetPendingReceivedCustomIDMap() map[string]struct{}
- func (c *Committee) GetProposal(hash common.Uint256) *ProposalState
- func (c *Committee) GetProposalByDraftHash(draftHash common.Uint256) *ProposalState
- func (c *Committee) GetProposalManager() *ProposalManagerdeprecated
- func (c *Committee) GetProposals(status ProposalStatus) ProposalsMap
- func (c *Committee) GetRealWithdrawTransactions() map[common.Uint256]types.OutputInfo
- func (c *Committee) GetReceivedCustomIDLists() []string
- func (c *Committee) GetRegisteredSideChainByHeight(height uint32) map[common.Uint256]payload.SideChainInfo
- func (c *Committee) GetReservedCustomIDLists() []string
- func (c *Committee) GetState() *Statedeprecated
- func (c *Committee) IsAppropriationNeeded() bool
- func (c *Committee) IsCRMember(programCode []byte) bool
- func (c *Committee) IsCRMemberByDID(did common.Uint168) bool
- func (c *Committee) IsCustomIDResultNeeded() bool
- func (c *Committee) IsElectedCRMemberByDID(did common.Uint168) bool
- func (c *Committee) IsInElectionPeriod() bool
- func (c *Committee) IsInVotingPeriod(height uint32) bool
- func (c *Committee) IsProposalAllowed(height uint32) bool
- func (c *Committee) IsProposalFull(did common.Uint168) bool
- func (c *Committee) ProcessBlock(block *types.Block, confirm *payload.Confirm)
- func (c *Committee) Recover(checkpoint *Checkpoint)
- func (c *Committee) RegisterFuncitons(cfg *CommitteeFuncsConfig)
- func (c *Committee) RollbackTo(height uint32) error
- func (c *Committee) Snapshot() *CommitteeKeyFrame
- func (c *Committee) TryRevertCRMemberIllegal(did common.Uint168, oriState MemberState, height uint32)
- func (c *Committee) TryRevertCRMemberInactivity(did common.Uint168, oriState MemberState, oriInactiveCount uint32, ...)
- func (c *Committee) TryUpdateCRMemberIllegal(did common.Uint168, height uint32)
- func (c *Committee) TryUpdateCRMemberInactivity(did common.Uint168, needReset bool, height uint32)
- type CommitteeFuncsConfig
- type CommitteeKeyFrame
- type DepositInfo
- type FunctionsConfig
- type ICRRecord
- type KeyFrame
- type MemberState
- type ProposalHashSet
- func (set *ProposalHashSet) Add(proposalHash common.Uint256) bool
- func (set *ProposalHashSet) Clear()
- func (set *ProposalHashSet) Contains(proposalHash common.Uint256) bool
- func (set *ProposalHashSet) Equal(other ProposalHashSet) bool
- func (set *ProposalHashSet) Len() int
- func (set *ProposalHashSet) Remove(proposalHash common.Uint256)
- type ProposalKeyFrame
- type ProposalManager
- type ProposalState
- type ProposalStatus
- type ProposalsMap
- type ReviewDraftDataMap
- type State
- func (s *State) ExistCandidateByCID(cid common.Uint168) (ok bool)
- func (s *State) IsCRTransaction(tx *types.Transaction) bool
- func (s *State) RevertUpdateCRIllegalPenalty(cid common.Uint168)
- func (s *State) RevertUpdateCRInactivePenalty(cid common.Uint168)
- func (s *State) SetManager(manager *ProposalManager)
- func (s *State) UpdateCRIllegalPenalty(cid common.Uint168)
- func (s *State) UpdateCRInactivePenalty(cid common.Uint168)
- type StateKeyFrame
- func (kf *StateKeyFrame) Deserialize(r io.Reader) (err error)
- func (kf *StateKeyFrame) DeserializeFixed64Map(r io.Reader) (vmap map[string]common.Fixed64, err error)
- func (kf *StateKeyFrame) Serialize(w io.Writer) (err error)
- func (kf *StateKeyFrame) SerializeFixed64Map(w io.Writer, vmap map[string]common.Fixed64) (err error)
- func (kf *StateKeyFrame) Snapshot() *StateKeyFrame
- type TrackingDraftDataMap
Constants ¶
const ( // MinDepositAmount is the minimum deposit as a producer. MinDepositAmount = 5000 * 100000000 // ActivateDuration is about how long we should activate from pending or // inactive state. ActivateDuration = 6 )
const CRAssetsRectifyInterval = time.Minute
const ( // EffectiveHeight defines interval to change src file to default file. EffectiveHeight = uint32(7) )
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type BudgetStatus ¶
type BudgetStatus uint8
const ( // Unfinished indicates the proposal owner haven't started or uploaded the // status of the budget to CR Council. Unfinished BudgetStatus = iota // Withdrawable indicates the proposal owner have finished the milestone, // but haven't get the payment. Withdrawable // Withdrawn indicates the proposal owner have finished the milestone and // got the payment. Withdrawn // Rejected indicates the proposal owner have uploaded the status to CR // Council but the secretary-general rejected my request. Rejected // Closed indicates the proposal has been terminated and the milestone will // not be finished forever. Closed )
func (*BudgetStatus) Name ¶
func (s *BudgetStatus) Name() string
type CRMember ¶
type CRMember struct { Info payload.CRInfo ImpeachmentVotes common.Fixed64 DepositHash common.Uint168 MemberState MemberState DPOSPublicKey []byte InactiveSince uint32 ActivateRequestHeight uint32 PenaltyBlockCount uint32 InactiveCount uint32 InactiveCountingHeight uint32 }
CRMember defines CR committee member related info.
type Candidate ¶
type Candidate struct {
// contains filtered or unexported fields
}
Candidate defines information about CR candidates during the CR vote period
func (*Candidate) CancelHeight ¶
RegisterHeight returns the height when the CR was unregistered.
func (*Candidate) RegisterHeight ¶
RegisterHeight returns the height when the CR was registered.
func (*Candidate) State ¶
func (c *Candidate) State() CandidateState
State returns the CR's state, can be pending, active, canceled or returned.
type CandidateState ¶
type CandidateState byte
CandidateState defines states during a CR candidates lifetime
const ( // Pending indicates the producer is just registered and didn't get 6 // confirmations yet. Pending CandidateState = iota // Active indicates the CR is registered and confirmed by more than // 6 blocks. Active // Canceled indicates the CR was canceled. Canceled // Returned indicates the CR has canceled and deposit returned. Returned )
func (CandidateState) String ¶
func (ps CandidateState) String() string
type Checkpoint ¶
type Checkpoint struct { KeyFrame StateKeyFrame ProposalKeyFrame // contains filtered or unexported fields }
Checkpoint hold all CR related states to recover from scratch.
func NewCheckpoint ¶
func NewCheckpoint(committee *Committee) *Checkpoint
func (*Checkpoint) DataExtension ¶
func (c *Checkpoint) DataExtension() string
func (*Checkpoint) Deserialize ¶
func (c *Checkpoint) Deserialize(r io.Reader) (err error)
func (*Checkpoint) EffectivePeriod ¶
func (c *Checkpoint) EffectivePeriod() uint32
func (*Checkpoint) Generator ¶
func (c *Checkpoint) Generator() func(buf []byte) checkpoint.ICheckPoint
func (*Checkpoint) GetHeight ¶
func (c *Checkpoint) GetHeight() uint32
func (*Checkpoint) Key ¶
func (c *Checkpoint) Key() string
func (*Checkpoint) LogError ¶
func (c *Checkpoint) LogError(err error)
func (*Checkpoint) OnBlockSaved ¶
func (c *Checkpoint) OnBlockSaved(block *types.DposBlock)
func (*Checkpoint) OnInit ¶
func (c *Checkpoint) OnInit()
func (*Checkpoint) OnRollbackSeekTo ¶ added in v0.8.0
func (c *Checkpoint) OnRollbackSeekTo(height uint32)
func (*Checkpoint) OnRollbackTo ¶
func (c *Checkpoint) OnRollbackTo(height uint32) error
func (*Checkpoint) Priority ¶
func (c *Checkpoint) Priority() checkpoint.Priority
func (*Checkpoint) SavePeriod ¶
func (c *Checkpoint) SavePeriod() uint32
func (*Checkpoint) SetHeight ¶
func (c *Checkpoint) SetHeight(height uint32)
func (*Checkpoint) Snapshot ¶
func (c *Checkpoint) Snapshot() checkpoint.ICheckPoint
func (*Checkpoint) StartHeight ¶
func (c *Checkpoint) StartHeight() uint32
type Committee ¶
type Committee struct { KeyFrame // contains filtered or unexported fields }
func NewCommittee ¶
func (*Committee) AvailableWithdrawalAmount ¶
func (*Committee) ExistCandidateByDepositHash ¶
func (*Committee) ExistCandidateByNickname ¶
func (*Committee) GetAllCandidates ¶
func (*Committee) GetAllMembers ¶
get all CRMembers ordered by CID
func (*Committee) GetAllMembersCopy ¶ added in v0.7.0
copy all CRMembers ordered by CID
func (*Committee) GetAllProposals ¶
func (c *Committee) GetAllProposals() ProposalsMap
func (*Committee) GetAllRegisteredSideChain ¶ added in v0.8.0
func (*Committee) GetAvailableDepositAmount ¶
func (*Committee) GetCROnDutyPeriod ¶ added in v0.7.0
func (*Committee) GetCROnDutyStartHeight ¶ added in v0.7.0
func (*Committee) GetCRVotingPeriod ¶ added in v0.7.0
func (*Committee) GetCRVotingStartHeight ¶ added in v0.7.0
func (*Committee) GetCandidateByCID ¶
GetCandidateByCID returns candidate with specified cid, it will return nil if not found.
func (*Committee) GetCandidateByID ¶
GetCandidateByID returns candidate with specified cid or did, it will return nil if not found.
func (*Committee) GetCandidateByPublicKey ¶
GetCandidateByPublicKey returns candidate with specified public key, it will return nil if not found.
func (*Committee) GetCandidates ¶
func (c *Committee) GetCandidates(state CandidateState) []*Candidate
func (*Committee) GetCommitteeCanUseAmount ¶ added in v0.7.0
func (*Committee) GetCustomIDResults ¶ added in v0.7.0
func (c *Committee) GetCustomIDResults() []payload.ProposalResult
func (*Committee) GetDepositAmountByID ¶
func (*Committee) GetDepositAmountByPublicKey ¶
func (*Committee) GetElectedMembers ¶
get all elected CRMembers
func (*Committee) GetImpeachableMembers ¶
get all impeachable CRMembers
func (*Committee) GetMemberByNodePublicKey ¶ added in v0.7.0
func (*Committee) GetMembersCodes ¶
func (*Committee) GetMembersDIDs ¶
func (*Committee) GetPendingReceivedCustomIDMap ¶ added in v0.7.0
func (*Committee) GetProposal ¶
func (c *Committee) GetProposal(hash common.Uint256) *ProposalState
func (*Committee) GetProposalByDraftHash ¶
func (c *Committee) GetProposalByDraftHash(draftHash common.Uint256) *ProposalState
func (*Committee) GetProposalManager
deprecated
func (c *Committee) GetProposalManager() *ProposalManager
Deprecated: just for testing
func (*Committee) GetProposals ¶
func (c *Committee) GetProposals(status ProposalStatus) ProposalsMap
func (*Committee) GetRealWithdrawTransactions ¶ added in v0.7.0
func (c *Committee) GetRealWithdrawTransactions() map[common.Uint256]types.OutputInfo
func (*Committee) GetReceivedCustomIDLists ¶ added in v0.7.0
func (*Committee) GetRegisteredSideChainByHeight ¶ added in v0.8.0
func (*Committee) GetReservedCustomIDLists ¶ added in v0.7.0
func (*Committee) IsAppropriationNeeded ¶
func (*Committee) IsCRMember ¶
func (*Committee) IsCustomIDResultNeeded ¶ added in v0.7.0
func (*Committee) IsElectedCRMemberByDID ¶ added in v0.7.0
func (*Committee) IsInElectionPeriod ¶
func (*Committee) IsInVotingPeriod ¶
func (*Committee) IsProposalAllowed ¶
func (*Committee) ProcessBlock ¶
func (*Committee) Recover ¶
func (c *Committee) Recover(checkpoint *Checkpoint)
func (*Committee) RegisterFuncitons ¶
func (c *Committee) RegisterFuncitons(cfg *CommitteeFuncsConfig)
func (*Committee) RollbackTo ¶
func (*Committee) Snapshot ¶
func (c *Committee) Snapshot() *CommitteeKeyFrame
func (*Committee) TryRevertCRMemberIllegal ¶ added in v0.7.0
func (c *Committee) TryRevertCRMemberIllegal(did common.Uint168, oriState MemberState, height uint32)
func (*Committee) TryRevertCRMemberInactivity ¶ added in v0.7.0
func (*Committee) TryUpdateCRMemberIllegal ¶ added in v0.7.0
type CommitteeFuncsConfig ¶
type CommitteeFuncsConfig struct { GetTxReference func(tx *types.Transaction) ( map[*types.Input]types.Output, error) GetHeight func() uint32 CreateCRAppropriationTransaction func() (*types.Transaction, common.Fixed64, error) CreateCRAssetsRectifyTransaction func() (*types.Transaction, error) CreateCRRealWithdrawTransaction func(withdrawTransactionHashes []common.Uint256, outpus []*types.OutputInfo) (*types.Transaction, error) IsCurrent func() bool Broadcast func(msg p2p.Message) AppendToTxpool func(transaction *types.Transaction) elaerr.ELAError GetUTXO func(programHash *common.Uint168) ([]*types.UTXO, error) }
type CommitteeKeyFrame ¶
type CommitteeKeyFrame struct { *KeyFrame *StateKeyFrame *ProposalKeyFrame }
type DepositInfo ¶
type DepositInfo struct { DepositAmount common.Fixed64 Penalty common.Fixed64 TotalAmount common.Fixed64 }
func (*DepositInfo) Deserialize ¶
func (d *DepositInfo) Deserialize(r io.Reader) (err error)
type FunctionsConfig ¶
type ICRRecord ¶
type ICRRecord interface { GetHeightsDesc() ([]uint32, error) GetCheckpoint(height uint32) (*Checkpoint, error) SaveCheckpoint(point *Checkpoint) error }
ICRRecord defines necessary operations about CR checkpoint
type KeyFrame ¶
type KeyFrame struct { Members map[common.Uint168]*CRMember HistoryMembers map[uint64]map[common.Uint168]*CRMember PartProposalResults []payload.ProposalResult LastCommitteeHeight uint32 LastVotingStartHeight uint32 InElectionPeriod bool NeedAppropriation bool NeedRecordProposalResult bool CRCFoundationBalance common.Fixed64 CRCCommitteeBalance common.Fixed64 CRCCommitteeUsedAmount common.Fixed64 CRCCurrentStageAmount common.Fixed64 DestroyedAmount common.Fixed64 CirculationAmount common.Fixed64 AppropriationAmount common.Fixed64 CommitteeUsedAmount common.Fixed64 CRAssetsAddressUTXOCount uint32 }
StateKeyFrame holds necessary state about CR committee.
func NewKeyFrame ¶
func NewKeyFrame() *KeyFrame
type MemberState ¶
type MemberState byte
MemberState defines states during a CR member lifetime
const ( // MemberElected indicates the CR member is Elected. MemberElected MemberState = iota // MemberImpeached indicates the CR member was impeached. MemberImpeached // MemberTerminated indicates the CR member was terminated because elected // CR members are not enough. MemberTerminated // MemberReturned indicates the CR member has deposit returned. MemberReturned // MemberInactive indicates the CR member was inactive because the dpos node // is inactive. MemberInactive // MemberIllegal indicates the CR member was illegal because the dpos node // is illegal. MemberIllegal )
func (*MemberState) String ¶
func (s *MemberState) String() string
type ProposalHashSet ¶
func NewProposalHashSet ¶
func NewProposalHashSet() ProposalHashSet
func (*ProposalHashSet) Clear ¶
func (set *ProposalHashSet) Clear()
func (*ProposalHashSet) Contains ¶
func (set *ProposalHashSet) Contains(proposalHash common.Uint256) bool
func (*ProposalHashSet) Equal ¶
func (set *ProposalHashSet) Equal(other ProposalHashSet) bool
func (*ProposalHashSet) Len ¶
func (set *ProposalHashSet) Len() int
func (*ProposalHashSet) Remove ¶
func (set *ProposalHashSet) Remove(proposalHash common.Uint256)
type ProposalKeyFrame ¶
type ProposalKeyFrame struct { // key is did value is proposalhash set Proposals ProposalsMap ProposalHashes map[common.Uint168]ProposalHashSet ProposalSession map[uint64][]common.Uint256 // proposalWithdraw info WithdrawableTxInfo map[common.Uint256]types.OutputInfo // publicKey of SecretaryGeneral SecretaryGeneralPublicKey string // reserved custom id list ReservedCustomIDLists []string // received custom id list PendingReceivedCustomIDMap map[string]struct{} ReceivedCustomIDLists []string // registered side chain name RegisteredSideChainNames []string // magic numbers RegisteredMagicNumbers []uint32 // genesis hashes RegisteredGenesisHashes []common.Uint256 // store register info with the approved height RegisteredSideChainPayloadInfo map[uint32]map[common.Uint256]payload.SideChainInfo //reserve CustomID ReservedCustomID bool }
ProposalKeyFrame holds all runtime state about CR proposals.
func NewProposalKeyFrame ¶
func NewProposalKeyFrame() *ProposalKeyFrame
func (*ProposalKeyFrame) Deserialize ¶
func (p *ProposalKeyFrame) Deserialize(r io.Reader) (err error)
func (*ProposalKeyFrame) Snapshot ¶
func (p *ProposalKeyFrame) Snapshot() *ProposalKeyFrame
Snapshot will create a new ProposalKeyFrame object and deep copy all related data.
type ProposalManager ¶
type ProposalManager struct { ProposalKeyFrame // contains filtered or unexported fields }
ProposalManager used to manage all proposals existing in block chain.
func NewProposalManager ¶
func NewProposalManager(params *config.Params) *ProposalManager
func (*ProposalManager) InitSecretaryGeneralPublicKey ¶ added in v0.7.0
func (p *ProposalManager) InitSecretaryGeneralPublicKey(publicKey string)
only init use
type ProposalState ¶
type ProposalState struct { Status ProposalStatus Proposal payload.CRCProposalInfo TxHash common.Uint256 TxPayloadVer byte CRVotes map[common.Uint168]payload.VoteResult VotersRejectAmount common.Fixed64 RegisterHeight uint32 VoteStartHeight uint32 WithdrawnBudgets map[uint8]common.Fixed64 // proposalWithdraw WithdrawableBudgets map[uint8]common.Fixed64 // proposalTracking BudgetsStatus map[uint8]BudgetStatus FinalPaymentStatus bool TrackingCount uint8 TerminatedHeight uint32 ProposalOwner []byte Recipient common.Uint168 }
ProposalState defines necessary state about an CR proposals.
func (*ProposalState) Deserialize ¶
func (p *ProposalState) Deserialize(r io.Reader) (err error)
type ProposalStatus ¶
type ProposalStatus uint8
const ( // Registered is the status means the CRC proposal tx has been on the best // chain. Registered ProposalStatus = 0x00 // CRAgreed means CRC has agreed the proposal. CRAgreed ProposalStatus = 0x01 // VoterAgreed means there are not enough negative vote about the proposal. VoterAgreed ProposalStatus = 0x02 // Finished means the proposal has run out the lifetime. Finished ProposalStatus = 0x03 // CRCanceled means the proposal canceled by CRC voting. CRCanceled ProposalStatus = 0x04 // VoterCanceled means the proposal canceled by voters' reject voting. VoterCanceled ProposalStatus = 0x05 // Terminated means proposal had been approved by both CR and voters, // whoever the proposal related project has been decided to terminate for // some reason. Terminated ProposalStatus = 0x06 // Aborted means the proposal was cancelled because of a snap election. Aborted ProposalStatus = 0x07 )
func (ProposalStatus) String ¶
func (status ProposalStatus) String() string
type ProposalsMap ¶
type ProposalsMap map[common.Uint256]*ProposalState
func NewProposalMap ¶
func NewProposalMap() ProposalsMap
type ReviewDraftDataMap ¶ added in v0.7.0
type State ¶
type State struct { StateKeyFrame // contains filtered or unexported fields }
State hold all CR candidates related information, and process block by block to update votes and any other changes about candidates.
func (*State) ExistCandidateByCID ¶
ExistCandidateByCID judges if there is a candidate with specified cid.
func (*State) IsCRTransaction ¶
func (s *State) IsCRTransaction(tx *types.Transaction) bool
IsCRTransaction returns if a transaction will change the CR and votes state.
func (*State) RevertUpdateCRIllegalPenalty ¶ added in v0.7.0
func (*State) RevertUpdateCRInactivePenalty ¶ added in v0.7.0
func (*State) SetManager ¶
func (s *State) SetManager(manager *ProposalManager)
SetManager set current proposal manager that holds state of proposals.
func (*State) UpdateCRIllegalPenalty ¶ added in v0.7.0
func (*State) UpdateCRInactivePenalty ¶ added in v0.7.0
type StateKeyFrame ¶
type StateKeyFrame struct { CodeCIDMap map[string]common.Uint168 DepositHashCIDMap map[common.Uint168]common.Uint168 Candidates map[common.Uint168]*Candidate HistoryCandidates map[uint64]map[common.Uint168]*Candidate CurrentSession uint64 Nicknames map[string]struct{} Votes map[string]struct{} DepositOutputs map[string]common.Fixed64 CRCFoundationOutputs map[string]common.Fixed64 CRCCommitteeOutputs map[string]common.Fixed64 // contains filtered or unexported fields }
StateKeyFrame holds necessary state about CR state.
func NewStateKeyFrame ¶
func NewStateKeyFrame() *StateKeyFrame
func (*StateKeyFrame) Deserialize ¶
func (kf *StateKeyFrame) Deserialize(r io.Reader) (err error)
func (*StateKeyFrame) DeserializeFixed64Map ¶
func (*StateKeyFrame) SerializeFixed64Map ¶
func (*StateKeyFrame) Snapshot ¶
func (kf *StateKeyFrame) Snapshot() *StateKeyFrame
Snapshot will create a new StateKeyFrame object and deep copy all related data.