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 }) => (
|
||||
<>
|
||||
<ContentFrame>
|
||||
<div className="py-4 text-sm">Block "{blockNumberOrHash}" not found.</div>
|
||||
</ContentFrame>
|
||||
</>
|
||||
<ContentFrame>
|
||||
<div className="py-4 text-sm">Block "{blockNumberOrHash}" not found.</div>
|
||||
</ContentFrame>
|
||||
);
|
||||
|
||||
export default React.memo(BlockNotFound);
|
||||
|
|
|
@ -43,7 +43,11 @@ export const readBlock = async (
|
|||
blockNumberOrHash,
|
||||
]);
|
||||
} 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;
|
||||
|
|
Loading…
Reference in New Issue