Add functionality to /block page to use height as well as hash

This commit is contained in:
joeuhren
2020-11-23 20:20:58 -07:00
parent 36a4f73659
commit 399883b04c
+12 -1
View File
@@ -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);
}
}
});
}