feat: Pin Kusama (#171)

This commit is contained in:
Maciej Hirsz
2019-08-26 18:21:02 +02:00
committed by GitHub
parent 0250fde939
commit d297202b7e
3 changed files with 7 additions and 5 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import { Types, SortedCollection } from '@dotstats/common';
import { AllChains, Chains, Chain, Ago, OfflineIndicator } from './components';
import { Connection } from './Connection';
import { PersistentObject, PersistentSet } from './persist';
import { State, Node, ChainData } from './state';
import { State, Node, ChainData, PINNED_CHAIN } from './state';
import { getHashData } from './utils';
import stable from 'stable';
@@ -158,11 +158,11 @@ export default class App extends React.Component<{}, State> {
.inplace(
Array.from(this.state.chains.entries()),
(a, b) => {
if (a[0] === 'Alexander') {
if (a[0] === PINNED_CHAIN) {
return -1;
}
if (b[0] === 'Alexander') {
if (b[0] === PINNED_CHAIN) {
return 1;
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { VERSION, timestamp, FeedMessage, Types, Maybe, sleep } from '@dotstats/common';
import { State, Update, Node, UpdateBound } from './state';
import { State, Update, Node, UpdateBound, PINNED_CHAIN } from './state';
import { PersistentSet } from './persist';
import { getHashData, setHashData } from './utils';
import { AfgHandling } from './AfgHandling';
@@ -416,7 +416,7 @@ export class Connection {
let topCount: Types.NodeCount = 0 as Types.NodeCount;
for (const [label, count] of chains.entries()) {
if (label === 'Alexander') {
if (label === PINNED_CHAIN) {
topLabel = label;
break;
}
+2
View File
@@ -1,5 +1,7 @@
import { Types, Maybe, SortedCollection } from '@dotstats/common';
export const PINNED_CHAIN = 'Kusama CC1';
export class Node {
public static compare(a: Node, b: Node): number {
if (a.pinned === b.pinned && a.stale === b.stale) {