From 57825c6c35cb1264dd13d1c7ac9e25fc078640df Mon Sep 17 00:00:00 2001 From: Youngjoon Lee <5462944+youngjoon-lee@users.noreply.github.com> Date: Mon, 12 May 2025 14:37:42 +0900 Subject: [PATCH] add comments --- cryptarchia/bootstrap.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cryptarchia/bootstrap.py b/cryptarchia/bootstrap.py index 66949ed..d94abc6 100644 --- a/cryptarchia/bootstrap.py +++ b/cryptarchia/bootstrap.py @@ -32,6 +32,7 @@ class Node: try: self.tree.on_block(block) except ParentNotFound: + # Download missing blocks unless they're in a fork behind the latest immutable block. if block.height <= self.tree.latest_immutable_block().height: continue self.download_blocks(peer, block.id) @@ -61,6 +62,7 @@ class Node: for block in peer.handle_download_blocks(req): num_downloaded_blocks += 1 latest_downloaded_block = block + # Stop downloading if the block is behind the latest immutable block. if block.height <= self.tree.latest_immutable_block().height: return try: @@ -68,6 +70,7 @@ class Node: except Exception: return + # Downloading is done if the peer returns blocks less than the limit. if num_downloaded_blocks < DOWNLOAD_LIMIT: return finally: