// Called when `floodsub` produces an event.
Called when `floodsub` produces an event.
Called when ` floodsub ` produces an event .
fn inject_event(&mut self, message: FloodsubEvent) {
        if let FloodsubEvent::Message(message) = message {
            //println!("Received: '{:?}' from {:?}", &message.data, message.source);
            let block: Block = bincode::deserialize::<Block>(&message.data).unwrap();
            println!("++++++++++"); // TODO(fishseasbowl): Replace with logging methods
            println!("++++++++++");
            println!("Recevie a new block {:?}", block);
            let _filepath = match std::env::args().nth(1) {
                Some(v) => v,
                None => String::from("./first"),
            };
            // this needs to be blockchain.add_block(block)
            //write_block(filepath, block);
        }
    }
fn inject_event ( & mut self , message : FloodsubEvent ) { if let FloodsubEvent :: Message ( message ) = message { //println!("Received: '{:?}' from {:?}", &message.data, message.source); let block : Block = bincode :: deserialize :: < Block > ( & message . data ) . unwrap ( ) ; println ! ( " " ) ; // TODO(fishseasbowl): Replace with logging methods println ! ( " " ) ; println ! ( " " block ) ; let _filepath = match std :: env :: args ( ) . nth ( 1 ) { Some ( v ) => v , None => String :: from ( " " ) , } ; // this needs to be blockchain.add_block(block) //write_block(filepath, block); } }
Called when `floodsub` produces an event.
Called when ` floodsub ` produces an event .
&mut self
message
FloodsubEvent