stop for loop after genesis block

prevHash == undefined for the genesis block
This commit is contained in:
Antoni Spaanderman 2022-01-20 19:24:30 +01:00
parent e581ef7fe3
commit e8986e5fdc
No known key found for this signature in database
GPG key ID: AE0B68E552E5DF8C

View file

@ -567,7 +567,7 @@ class Routes {
}
let nextHash = startFromHash;
for (let i = 0; i < 10; i++) {
for (let i = 0; i < 10 && nextHash; i++) {
const localBlock = blocks.getBlocks().find((b) => b.id === nextHash);
if (localBlock) {
returnBlocks.push(localBlock);