Non-zero lastZeroSlash (#3364)

* Displayed chilled nominators in waiting

* Non-zero-era slashingSpans
This commit is contained in:
Jaco Greeff 2020-08-07 13:00:20 +02:00 committed by GitHub
parent dbdaed4ea6
commit fd70692193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -18,9 +18,15 @@ interface Inactives {
function extractState (stashId: string, slashes: Option<SlashingSpans>[], nominees: string[], activeEra: EraIndex, submittedIn: EraIndex, exposures: Exposure[]): Inactives {
// chilled
const nomsChilled = nominees.filter((_, index) =>
slashes[index].isSome && slashes[index].unwrap().lastNonzeroSlash.gte(submittedIn)
);
const nomsChilled = nominees.filter((_, index): boolean => {
if (slashes[index].isNone) {
return false;
}
const { lastNonzeroSlash } = slashes[index].unwrap();
return !lastNonzeroSlash.isZero() && lastNonzeroSlash.gte(submittedIn);
});
// first a blanket find of nominations not in the active set
let nomsInactive = exposures

View File

@ -28,7 +28,7 @@ function NominatedBy ({ nominators, slashingSpans }: Props): React.ReactElement<
if (nominators) {
const chilled = slashingSpans
? nominators
.filter(([, submittedIn]) => submittedIn.lte(slashingSpans.lastNonzeroSlash))
.filter(([, submittedIn]) => !slashingSpans.lastNonzeroSlash.isZero() && slashingSpans.lastNonzeroSlash.gte(submittedIn))
.map(([who]) => who)
: [];
const active = nominators