Skip to content

Commit

Permalink
fix(core-p2p): avoid iterating on non-iterable peerBlocks
Browse files Browse the repository at this point in the history
If peerBlocks is falsy, then "for (const block of peerBlocks) {"
would throw an exception that peerBlocks is not iterable.
  • Loading branch information
vasild committed Jul 1, 2019
1 parent 134fdf6 commit 65f5b6f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/core-p2p/src/peer-communicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export class PeerCommunicator implements P2P.IPeerCommunicator {
this.logger.debug(
`Peer ${peer.ip} did not return any blocks via height ${fromBlockHeight.toLocaleString()}.`,
);
return [];
}

// To stay backward compatible, don't assume peers respond with serialized transactions just yet.
Expand Down

0 comments on commit 65f5b6f

Please sign in to comment.