setting 0 ratios for not whitelisted runners
This commit is contained in:
@@ -100,7 +100,11 @@ impl EpochSigningResults {
|
||||
let vp: u64 = raw_results.voting_power.try_into().unwrap_or_default();
|
||||
let signed: u64 = raw_results.signed_blocks.try_into().unwrap_or_default();
|
||||
|
||||
let voting_power_ratio = Decimal::from_ratio(vp, total_vp_u64);
|
||||
let voting_power_ratio = if raw_results.whitelisted {
|
||||
Decimal::from_ratio(vp, total_vp_u64)
|
||||
} else {
|
||||
Decimal::zero()
|
||||
};
|
||||
|
||||
debug_assert!(signed <= blocks_u64);
|
||||
let ratio_signed = Decimal::from_ratio(signed, blocks_u64);
|
||||
|
||||
@@ -163,7 +163,7 @@ impl From<MonitoringResultsInner> for CredentialIssuanceResults {
|
||||
let mut total_issued = 0;
|
||||
|
||||
for operator in value.operators.values() {
|
||||
// if this validator is NOT whitelisted, do not increase the total VP
|
||||
// if this validator is NOT whitelisted, do not increase the total issued credentials
|
||||
if operator.whitelisted {
|
||||
let operator_issued: u32 = operator
|
||||
.per_epoch
|
||||
@@ -182,7 +182,7 @@ impl From<MonitoringResultsInner> for CredentialIssuanceResults {
|
||||
.operators
|
||||
.into_values()
|
||||
.map(|runner| {
|
||||
let issued_ratio = if total_issued == 0 {
|
||||
let issued_ratio = if total_issued == 0 || !runner.whitelisted {
|
||||
Decimal::zero()
|
||||
} else {
|
||||
Decimal::from_ratio(runner.issued_credentials(), total_issued)
|
||||
|
||||
Reference in New Issue
Block a user