returns the candidate by self-staking index
@@ -73,6 +73,14 @@ func (m CandidateCenter) GetByOwner(owner address.Address) *Candidate {
return nil
}
+// GetBySelfStakingIndex returns the candidate by self-staking index
+func (m CandidateCenter) GetBySelfStakingIndex(index uint64) *Candidate {
+ if d, ok := m.selfStkBucketMap[index]; ok {
+ return d.Clone()
+ }
+ return nil
+}
+
// Put writes the candidate into map
func (m CandidateCenter) Put(d *Candidate) error {
m.nameMap[d.Name] = d
