refactor(esplora): better variable naming and docs

This commit is contained in:
志宇
2024-01-31 15:55:44 +08:00
parent 216648bcfd
commit 929b5ddb0c
3 changed files with 64 additions and 43 deletions

View File

@@ -105,8 +105,8 @@ impl EsploraAsyncExt for esplora_client::AsyncClient {
.copied()
.expect("must have atleast one block");
// fetch blocks of heights that the caller is interested in, reusing latest blocks that are
// already fetched.
// Fetch blocks of heights that the caller is interested in, skipping blocks that are
// already fetched when constructing `fetched_blocks`.
for height in request_heights {
// do not fetch blocks higher than remote tip
if height > new_tip_height {
@@ -122,7 +122,8 @@ impl EsploraAsyncExt for esplora_client::AsyncClient {
}
}
// Ensure `fetched_blocks` can create an update that connects with the original chain.
// Ensure `fetched_blocks` can create an update that connects with the original chain by
// finding a "Point of Agreement".
for (height, local_hash) in local_tip.iter().map(|cp| (cp.height(), cp.hash())) {
if height > new_tip_height {
continue;

View File

@@ -97,8 +97,8 @@ impl EsploraExt for esplora_client::BlockingClient {
.copied()
.expect("must atleast have one block");
// fetch blocks of heights that the caller is interested in, reusing latest blocks that are
// already fetched.
// Fetch blocks of heights that the caller is interested in, skipping blocks that are
// already fetched when constructing `fetched_blocks`.
for height in request_heights {
// do not fetch blocks higher than remote tip
if height > new_tip_height {
@@ -114,7 +114,8 @@ impl EsploraExt for esplora_client::BlockingClient {
}
}
// Ensure `fetched_blocks` can create an update that connects with the original chain.
// Ensure `fetched_blocks` can create an update that connects with the original chain by
// finding a "Point of Agreement".
for (height, local_hash) in local_tip.iter().map(|cp| (cp.height(), cp.hash())) {
if height > new_tip_height {
continue;