message: Pass deploys which have been gossiped to `DeployBuffer`
diff: @@ -58,6 +58,7 @@ use crate::{
  requests::{BlockSynchronizerRequest, ChainspecRawBytesRequest},
  EffectBuilder, EffectExt, Effects,
  },
  + fatal,
  protocol::Message,
  reactor::{
  self, event_queue_metrics::EventQueueMetrics, main_reactor::fetchers::Fetchers,
  @@ -837,19 +838,13 @@ impl reactor::Reactor for MainReactor {
  DeployAcceptorAnnouncement::AcceptedNewDeploy { deploy, source },
  ) => {
  let mut effects = self.dispatch_event(
  - effect_builder,
  - rng,
  - MainEvent::DeployBuffer(deploy_buffer::Event::ReceiveDeploy(deploy.clone())),
  - );
  -
  - effects.extend(self.dispatch_event(
  effect_builder,
  rng,
  MainEvent::DeployGossiper(gossiper::Event::ItemReceived {
  item_id: deploy.id(),
  source: source.clone(),
  }),
  - ));
  + );
  effects.extend(self.dispatch_event(
  effect_builder,
  @@ -911,15 +906,36 @@ impl reactor::Reactor for MainReactor {
  ),
  ),
  MainEvent::DeployGossiperAnnouncement(GossiperAnnouncement::FinishedGossiping(
  - _gossiped_deploy_id,
  + gossiped_deploy_id,
  )) => {
  - // [TODO][Fraser]: notify DeployBuffer the deploy can be proposed
  - // let reactor_event =
  - // MainEvent::DeployBuffer(deploy_buffer::Event::
  - // BufferDeploy(gossiped_deploy_id));
  - // self.dispatch_event(effect_builder, rng, reactor_event)
  + let deploy_hash = gossiped_deploy_id.deploy_hash();
  + let maybe_deploy = match self
  + .storage
  + .read_deploy_by_hash(gossiped_deploy_id.deploy_hash())
  + {
  + Ok(maybe_deploy) => maybe_deploy,
  + Err(_) => {
  + return fatal!(
  + effect_builder,
  + "fatal error while reading deploy from storage, hash={}",
  + deploy_hash,
  + )
  + .ignore();
  + }
  + };
  + if let Some(deploy) = maybe_deploy {
  + let reactor_event = MainEvent::DeployBuffer(
  + deploy_buffer::Event::ReceiveDeploy(Box::new(deploy)),
  + );
  + self.dispatch_event(effect_builder, rng, reactor_event)
  + } else {
  + error!(
  + %deploy_hash,
  + "reported gossip finished for deploy which is not in storage"
  + );
  Effects::new()
  }
  + }
  MainEvent::DeployBuffer(event) => reactor::wrap_effects(
  MainEvent::DeployBuffer,
  self.deploy_buffer.handle_event(effect_builder, rng, event),
  