Fix negative block numbers
This commit is contained in:
parent
9ca79e838f
commit
088781babb
|
@ -6,11 +6,9 @@ type BlockNotFoundProps = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const BlockNotFound: React.FC<BlockNotFoundProps> = ({ blockNumberOrHash }) => (
|
const BlockNotFound: React.FC<BlockNotFoundProps> = ({ blockNumberOrHash }) => (
|
||||||
<>
|
<ContentFrame>
|
||||||
<ContentFrame>
|
<div className="py-4 text-sm">Block "{blockNumberOrHash}" not found.</div>
|
||||||
<div className="py-4 text-sm">Block "{blockNumberOrHash}" not found.</div>
|
</ContentFrame>
|
||||||
</ContentFrame>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export default React.memo(BlockNotFound);
|
export default React.memo(BlockNotFound);
|
||||||
|
|
|
@ -43,7 +43,11 @@ export const readBlock = async (
|
||||||
blockNumberOrHash,
|
blockNumberOrHash,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
blockPromise = provider.send("ots_getBlockDetails", [blockNumberOrHash]);
|
const blockNumber = parseInt(blockNumberOrHash);
|
||||||
|
if (isNaN(blockNumber) || blockNumber < 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
blockPromise = provider.send("ots_getBlockDetails", [blockNumber]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const _rawBlock = await blockPromise;
|
const _rawBlock = await blockPromise;
|
||||||
|
|
Loading…
Reference in New Issue