Revert watermark calc to bestNumber (not bestFinalized) (#4400)

This commit is contained in:
Jaco Greeff 2021-01-13 23:26:04 +01:00 committed by GitHub
parent b435b98e0b
commit a13315faca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -15,7 +15,7 @@ import { formatNumber } from '@polkadot/util';
import { sliceHex } from './util';
interface Props {
bestNumberFinalized?: BN;
bestNumber?: BN;
className?: string;
id: ParaId;
}
@ -44,7 +44,7 @@ function getChainLink (endpoints: LinkOption[]): React.ReactNode {
return <a href={`${window.location.origin}${window.location.pathname}?rpc=${encodeURIComponent(value)}`}>{text}</a>;
}
function Parachain ({ bestNumberFinalized, className = '', id }: Props): React.ReactElement<Props> {
function Parachain ({ bestNumber, className = '', id }: Props): React.ReactElement<Props> {
const { api } = useApi();
const { api: paraApi, endpoints } = useParaApi(id);
const headHex = useCall<string | null>(api.query.paras.heads, [id], transformHead);
@ -53,8 +53,8 @@ function Parachain ({ bestNumberFinalized, className = '', id }: Props): React.R
const paraIssu = useCall<Balance>(paraApi?.query.balances?.totalIssuance);
const blockDelay = useMemo(
() => watermark && bestNumberFinalized && bestNumberFinalized.sub(watermark),
[bestNumberFinalized, watermark]
() => watermark && bestNumber && bestNumber.sub(watermark),
[bestNumber, watermark]
);
const chainLink = useMemo(

View File

@ -19,7 +19,7 @@ interface Props {
function ParachainList ({ ids }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const bestNumberFinalized = useCall<BN>(api.derive.chain.bestNumberFinalized);
const bestNumber = useCall<BN>(api.derive.chain.bestNumber);
const headerRef = useRef([
[t('parachains'), 'start', 2],
@ -36,7 +36,7 @@ function ParachainList ({ ids }: Props): React.ReactElement<Props> {
>
{ids?.map((id): React.ReactNode => (
<Parachain
bestNumberFinalized={bestNumberFinalized}
bestNumber={bestNumber}
id={id}
key={id.toString()}
/>

View File

@ -49,9 +49,9 @@ function Summary ({ parachainCount, proposalCount, upcomingCount }: Props): Reac
<section>
<CardSummary
className='media--800'
label={t<string>('finalized block')}
label={t<string>('best block')}
>
<BestNumber isFinalized />
<BestNumber isFinalized={false} />
</CardSummary>
<SummarySession withEra={false} />
</section>