Skip to content

Commit

Permalink
Add functionality to /block page to use height as well as hash
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed Jul 21, 2020
1 parent 897d6b9 commit 7358038
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ function route_get_block(res, blockhash) {
});
}
} else {
route_get_index(res, 'Block not found: ' + blockhash);
if (!isNaN(blockhash)) {
var height = blockhash;
lib.get_blockhash(height, function(hash) {
if (hash != 'There was an error. Check your console.') {
res.redirect('/block/' + hash);
} else {
route_get_index(res, 'Block not found: ' + blockhash);
}
});
} else {
route_get_index(res, 'Block not found: ' + blockhash);
}
}
});
}
Expand Down

1 comment on commit 7358038

@RaulBernal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool 😁

Please sign in to comment.