Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cardano-chain-follower): set_read_pointer now returns None when the requested point is not found #184

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 19 additions & 13 deletions hermes/crates/cardano-chain-follower/src/follow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,19 +485,25 @@ mod task {
continue;
};

let Ok(Some(from)) = set_client_read_pointer(&mut client, at).await else {
drop(response_tx.send(Err(crate::Error::SetReadPointer)));
continue;
};

fetch_chain_updates_fut.set(Self::fetch_chain_updates(
client,
self.mithril_snapshot.as_ref(),
self.chain_update_tx.clone(),
from,
));

drop(response_tx.send(Ok(None)));
match set_client_read_pointer(&mut client, at).await {
Ok(Some(from)) => {
fetch_chain_updates_fut.set(Self::fetch_chain_updates(
client,
self.mithril_snapshot.as_ref(),
self.chain_update_tx.clone(),
from.clone(),
));

drop(response_tx.send(Ok(Some(from))));
}
Ok(None) => {
drop(response_tx.send(Ok(None)));
}
Err(_) => {
drop(response_tx.send(Err(crate::Error::SetReadPointer)));
continue;
}
}
}

() = &mut fetch_chain_updates_fut => {}
Expand Down