Skip to content

Commit

Permalink
feat: Add chain follower block fetch methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Rosa committed Dec 12, 2023
1 parent 603dfe4 commit dfd6d80
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions hermes/crates/cardano-chain-follower/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
pub use pallas::network::miniprotocols::Point;
use pallas::{
ledger::traverse::MultiEraBlock,
network::{
facades::PeerClient,
miniprotocols::{MAINNET_MAGIC, PREVIEW_MAGIC, PRE_PRODUCTION_MAGIC, TESTNET_MAGIC},
},
network::miniprotocols::{MAINNET_MAGIC, PREVIEW_MAGIC, PRE_PRODUCTION_MAGIC, TESTNET_MAGIC},
};

const DEFAULT_BLOCK_BUFFER_SIZE: usize = 32;
Expand Down Expand Up @@ -164,7 +161,33 @@ impl Follower {
todo!()
}

Ok(Self { n2n_client, config })
/// Fetches a single block from the chain.
///
/// # Arguments
///
/// * `at`: The point at which to fetch the block.
///
/// # Errors
///
/// Returns Err if the block was not found or if some communication error ocurred.
pub async fn fetch_block(&mut self, _at: Point) -> Result<MultiEraBlockData> {
todo!()
}

/// Fetches a range of blocks from the chain.
///
/// # Arguments
///
/// * `from`: The point at which to start fetching block from.
/// * `to`: The point up to which the blocks will be fetched.
///
/// # Errors
///
/// Returns Err if the block range was not found or if some communication error ocurred.
pub async fn fetch_block_range(
&mut self, _from: Point, _to: Point,
) -> Result<Vec<MultiEraBlockData>> {
todo!()
}

/// Set the follower's chain read-pointer. Returns None if the point was
Expand Down

0 comments on commit dfd6d80

Please sign in to comment.