feat(chainsync): add cursor to observer args

This commit is contained in:
Santiago Carmuega 2021-12-09 06:49:48 -03:00
parent 61b37cce41
commit b55ee1799f

View file

@ -10,8 +10,8 @@ use crate::{BlockBody, Message, State, Tip, WrappedHeader};
/// An observer of chain-sync events sent by the state-machine
pub trait Observer<C> where C: Debug {
fn on_block(&self, content: &C) -> Result<(), Box<dyn std::error::Error>> {
log::debug!("asked to save block {:?}", content);
fn on_block(&self, cursor: &Option<Point>, content: &C) -> Result<(), Box<dyn std::error::Error>> {
log::debug!("asked to save block content {:?} at cursor {:?}", content, cursor);
Ok(())
}
@ -127,7 +127,7 @@ where
}
debug!("reporint block to observer");
self.observer.on_block(&content)?;
self.observer.on_block(&self.cursor, &content)?;
Ok(Self {
tip: Some(tip),