diff --git a/blocks.ts b/blocks.ts
index 9b5b804..9e7b412 100644
--- a/blocks.ts
+++ b/blocks.ts
@@ -5,7 +5,7 @@ import config from "./config/config.ts";
export interface IBlock {
height: number;
// hash: string;
- signals: boolean;
+ signals: boolean | undefined;
}
const blocks: IBlock[] = [];
@@ -14,10 +14,19 @@ export async function bootstrapBlocks() {
console.log("Bootstrapping block data...");
const blockCount = await getblockcount();
- const startHeight = blockCount - 1000;
+ const difficultyPeriodStartHeight = blockCount - (blockCount % 2016);
+ const difficultyPeriodEndHeight = difficultyPeriodStartHeight + 2016;
+
console.log(`Current block height is ${blockCount}`);
- for (let i = startHeight; i < blockCount; i++) {
+ for (let i = difficultyPeriodStartHeight; i < difficultyPeriodEndHeight; i++) {
+ if (i > blockCount) {
+ blocks.push({
+ height: i,
+ signals: undefined,
+ });
+ continue;
+ }
try {
const blockHash = await getblockhash(i);
const blockheader = await getblockheader(blockHash);
diff --git a/frontend/components/Content.ts b/frontend/components/Content.ts
index 0eac67a..b7e9489 100644
--- a/frontend/components/Content.ts
+++ b/frontend/components/Content.ts
@@ -3,5 +3,5 @@ import styled from "https://esm.sh/styled-components";
export const Content = styled.div`
flex-direction: row;
width: 80%;
- max-width: 1246px;
+ max-width: 1423px;
`;
diff --git a/frontend/pages/index.tsx b/frontend/pages/index.tsx
index 9d2881f..6c2f947 100644
--- a/frontend/pages/index.tsx
+++ b/frontend/pages/index.tsx
@@ -27,7 +27,7 @@ const Text = styled.p`
text-align: center;
`;
-const LastXBlocks = styled.h2`
+const CurrentPeriod = styled.h2`
font-size: 24px;
margin-bottom: 10px;
color: #ff9b20;
@@ -51,16 +51,27 @@ const BlockStyle = styled.div<{ signals?: boolean }>`
props.signals
? "linear-gradient(45deg, rgba(18,209,0,1) 0%, rgba(9,89,0,1) 100%)"
: "linear-gradient(45deg, rgba(209,0,0,1) 0%, rgba(89,0,0,1) 100%)"};
- width: 20px;
- height: 20px;
+ border: 1px solid #434343;
+ width: 18px;
+ height: 18px;
+ margin: 3px;
+ border-radius: 4px;
+`;
+const EmptyBlock = styled.div`
+ border: 1px solid #5a5a5a;
+ width: 18px;
+ height: 18px;
margin: 3px;
border-radius: 4px;
`;
interface IBlockProps {
height: number;
- signals: boolean;
+ signals: boolean | undefined;
}
function Block({ height, signals }: IBlockProps) {
+ if (signals === undefined) {
+ return ;
+ }
return ;
}
@@ -92,7 +103,7 @@ export default function Blocks() {
{text}
))}
- Last {Math.min(1000, blocks.length)} blocks
+ Current signalling period of 2016 blocks
{blocks.map((block, i) => (