fix search block

This commit is contained in:
Roma3928 2024-12-02 13:26:36 +00:00
parent 14c1c5d830
commit bf0e65d754
2 changed files with 3 additions and 1 deletions

View file

@ -62,7 +62,7 @@ function Block(props: BlockProps) {
useEffect(() => {
async function fetchHash() {
if (!height) return;
if (height === null) return;
const prevHashFetched = await Fetch.getHashByHeight(height - 1);
const nextHashFetched = await Fetch.getHashByHeight(height + 1);
setPrevHash(prevHashFetched);

View file

@ -42,6 +42,8 @@ class Fetch {
}
static async getHashByHeight(height: number): Promise<string | null> {
if (height === -1) return "";
const result = await this.getBlockDetails(height, 1);
if (result.success === false) return null;
if (!(result instanceof Array)) return null;