mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 10:20:44 +00:00
not sort candidates in getCandidatesFromSmartContract
This commit is contained in:
parent
7dc5ffe45a
commit
5d24dfdf7e
1 changed files with 1 additions and 7 deletions
|
|
@ -1016,7 +1016,7 @@ func (s *PublicBlockChainAPI) getCandidatesFromSmartContract() ([]utils.Masterno
|
||||||
return []utils.Masternode{}, err
|
return []utils.Masternode{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var candidatesWithStakeInfo []utils.Masternode
|
candidatesWithStakeInfo := make([]utils.Masternode, 0, len(candidates))
|
||||||
|
|
||||||
for _, candidate := range candidates {
|
for _, candidate := range candidates {
|
||||||
if !candidate.IsZero() {
|
if !candidate.IsZero() {
|
||||||
|
|
@ -1027,12 +1027,6 @@ func (s *PublicBlockChainAPI) getCandidatesFromSmartContract() ([]utils.Masterno
|
||||||
|
|
||||||
candidatesWithStakeInfo = append(candidatesWithStakeInfo, utils.Masternode{Address: candidate, Stake: v})
|
candidatesWithStakeInfo = append(candidatesWithStakeInfo, utils.Masternode{Address: candidate, Stake: v})
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(candidatesWithStakeInfo) > 0 {
|
|
||||||
sort.Slice(candidatesWithStakeInfo, func(i, j int) bool {
|
|
||||||
return candidatesWithStakeInfo[i].Stake.Cmp(candidatesWithStakeInfo[j].Stake) >= 0
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return candidatesWithStakeInfo, nil
|
return candidatesWithStakeInfo, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue