mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
return more slashed nodes in GetCandidates
This commit is contained in:
parent
6e7d7f5002
commit
8ed9a754b2
1 changed files with 11 additions and 12 deletions
|
|
@ -965,20 +965,19 @@ func (s *PublicBlockChainAPI) GetCandidates(ctx context.Context, epoch rpc.Epoch
|
||||||
}
|
}
|
||||||
penaltyList = common.ExtractAddressFromBytes(penalties)
|
penaltyList = common.ExtractAddressFromBytes(penalties)
|
||||||
|
|
||||||
var topCandidates []utils.Masternode
|
// check penalties from checkpoint headers and modify status of a node to SLASHED if it's in top maxMasternodes candidates.
|
||||||
if len(candidates) > maxMasternodes {
|
// if it's SLASHED but it's out of top maxMasternodes, the status should be still PROPOSED.
|
||||||
topCandidates = candidates[:maxMasternodes]
|
total := len(masternodes)
|
||||||
} else {
|
for _, candidate := range candidates {
|
||||||
topCandidates = candidates
|
for _, pen := range penaltyList {
|
||||||
}
|
if candidate.Address == pen {
|
||||||
// check penalties from checkpoint headers and modify status of a node to SLASHED if it's in top 150 candidates
|
|
||||||
// if it's SLASHED but it's out of top 150, the status should be still PROPOSED
|
|
||||||
for _, pen := range penaltyList {
|
|
||||||
for _, candidate := range topCandidates {
|
|
||||||
if candidate.Address == pen && candidatesStatusMap[pen.String()] != nil {
|
|
||||||
candidatesStatusMap[pen.String()][fieldStatus] = statusSlashed
|
candidatesStatusMap[pen.String()][fieldStatus] = statusSlashed
|
||||||
|
total++
|
||||||
|
if total >= maxMasternodes {
|
||||||
|
result[fieldCandidates] = candidatesStatusMap
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
penalties = append(penalties, block.Penalties()...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue