Add missing 1 offset to slash retrieval (#8507)
This commit is contained in:
parent
a5708a2fa6
commit
6c98feeb74
@ -8,7 +8,7 @@ import type { PalletStakingUnappliedSlash } from '@polkadot/types/lookup';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { BN, BN_ONE, BN_ZERO } from '@polkadot/util';
|
||||
import { BN, BN_HUNDRED, BN_ONE, BN_ZERO } from '@polkadot/util';
|
||||
|
||||
import { createNamedHook } from './createNamedHook';
|
||||
import { useApi } from './useApi';
|
||||
@ -28,9 +28,10 @@ function useAvailableSlashesImpl (): [BN, PalletStakingUnappliedSlash[]][] {
|
||||
let unsub: Unsub | undefined;
|
||||
const [from, offset] = api.query.staking?.earliestUnappliedSlash
|
||||
? [earliestSlash && earliestSlash.unwrapOr(null), BN_ZERO]
|
||||
: [indexes?.activeEra, api.consts.staking?.slashDeferDuration];
|
||||
// future depth (one more than activeEra for delay)
|
||||
: [indexes?.activeEra, BN_ONE.add(api.consts.staking?.slashDeferDuration || BN_HUNDRED)];
|
||||
|
||||
if (mountedRef.current && indexes && from && offset) {
|
||||
if (mountedRef.current && indexes && from) {
|
||||
const range: BN[] = [];
|
||||
const end = indexes.activeEra.add(offset);
|
||||
let start = new BN(from);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user