Skip to content

Commit

Permalink
Add last fetched to tip
Browse files Browse the repository at this point in the history
  • Loading branch information
gostkin committed Aug 30, 2023
1 parent 93847f5 commit b013510
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions blockchain-source/src/cardano/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ use tracing::{debug, error, info, warn, Instrument};

const TX_PROCESSING_CHANNEL_BOUND: usize = 1000;

type Event = CardanoNetworkEvent<BlockEvent, Tip>;
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct TipAndLastFetched {
tip: Tip,
last_fethed: Point,
}

type Event = CardanoNetworkEvent<BlockEvent, TipAndLastFetched>;

pub struct CardanoSource {
service: mpsc::Sender<(Vec<Point>, mpsc::Sender<Result<Event>>)>,
Expand Down Expand Up @@ -267,7 +274,10 @@ async fn block_fetch(

if last_tip_event.elapsed() >= tip_update_pace {
if channel
.send(Ok(CardanoNetworkEvent::Tip(tip.clone())))
.send(Ok(CardanoNetworkEvent::Tip(TipAndLastFetched {
tip: tip.clone(),
last_fethed: Point::from(from.clone()),
})))
.await
.is_err()
{
Expand Down

0 comments on commit b013510

Please sign in to comment.