diff --git a/examples/block-download/src/main.rs b/examples/block-download/src/main.rs index 6fb45e8..9dec596 100644 --- a/examples/block-download/src/main.rs +++ b/examples/block-download/src/main.rs @@ -16,7 +16,7 @@ use std::net::TcpStream; struct BlockPrinter; impl Observer for BlockPrinter { - fn on_block_received(&self, body: Vec) -> Result<(), Box> { + fn on_block_received(&mut self, body: Vec) -> Result<(), Box> { println!("{}", hex::encode(&body)); println!("----------"); Ok(()) diff --git a/pallas-miniprotocols/src/blockfetch/mod.rs b/pallas-miniprotocols/src/blockfetch/mod.rs index 6043010..3fd1d60 100644 --- a/pallas-miniprotocols/src/blockfetch/mod.rs +++ b/pallas-miniprotocols/src/blockfetch/mod.rs @@ -88,7 +88,7 @@ impl<'b> Decode<'b> for Message { } pub trait Observer { - fn on_block_received(&self, body: Vec) -> Result<(), Box> { + fn on_block_received(&mut self, body: Vec) -> Result<(), Box> { log::debug!("block received, sice: {}", body.len()); Ok(()) } @@ -148,7 +148,7 @@ where }) } - fn on_block(self, body: Vec) -> Transition { + fn on_block(mut self, body: Vec) -> Transition { log::debug!("received block body, size {}", body.len()); self.observer.on_block_received(body)?; @@ -287,7 +287,7 @@ where }) } - fn on_block(self, body: Vec) -> Transition { + fn on_block(mut self, body: Vec) -> Transition { log::debug!("received block body, size {}", body.len()); self.observer.on_block_received(body)?;