finalization_handler.rs
1 use fedimint_core::PeerId; 2 3 use super::data_provider::UnitData; 4 5 pub struct FinalizationHandler { 6 sender: async_channel::Sender<(UnitData, PeerId)>, 7 } 8 9 impl FinalizationHandler { 10 pub fn new(sender: async_channel::Sender<(UnitData, PeerId)>) -> Self { 11 Self { sender } 12 } 13 } 14 15 impl aleph_bft::FinalizationHandler<UnitData> for FinalizationHandler { 16 fn data_finalized(&mut self, unit_data: UnitData, creator: aleph_bft::NodeIndex) { 17 // the channel is unbounded 18 self.sender 19 .try_send((unit_data, super::to_peer_id(creator))) 20 .ok(); 21 } 22 }