mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
check slashed status in GetCandidateStatus
This commit is contained in:
parent
e17a0869e5
commit
f32c66ebc1
1 changed files with 15 additions and 5 deletions
|
|
@ -819,7 +819,7 @@ func (s *PublicBlockChainAPI) GetCandidateStatus(ctx context.Context, coinbaseAd
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Third, Get penalties list
|
// Get penalties list
|
||||||
penalties = append(penalties, header.Penalties...)
|
penalties = append(penalties, header.Penalties...)
|
||||||
// check last 5 epochs to find penalize masternodes
|
// check last 5 epochs to find penalize masternodes
|
||||||
for i := 1; i <= common.LimitPenaltyEpoch; i++ {
|
for i := 1; i <= common.LimitPenaltyEpoch; i++ {
|
||||||
|
|
@ -837,12 +837,22 @@ func (s *PublicBlockChainAPI) GetCandidateStatus(ctx context.Context, coinbaseAd
|
||||||
penaltyList = common.ExtractAddressFromBytes(penalties)
|
penaltyList = common.ExtractAddressFromBytes(penalties)
|
||||||
|
|
||||||
// map slashing status
|
// map slashing status
|
||||||
for _, pen := range penaltyList {
|
total := len(masternodes)
|
||||||
if coinbaseAddress == pen {
|
for _, candidate := range candidates {
|
||||||
result[fieldStatus] = statusSlashed
|
for _, pen := range penaltyList {
|
||||||
return result, nil
|
if candidate.Address == pen {
|
||||||
|
if coinbaseAddress == pen {
|
||||||
|
result[fieldStatus] = statusSlashed
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
total++
|
||||||
|
if total >= maxMasternodes {
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue