message: feat: add api to clear tx-pool
diff: @@ -77,6 +77,7 @@ pub enum Message {
  FetchTxRPC(Request<ProposalShortId, Option<(bool, TransactionView)>>),
  NewUncle(Notify<UncleBlockView>),
  PlugEntry(Request<(Vec<TxEntry>, PlugTarget), ()>),
  + ClearPool(Request<(), ()>),
  }
  #[derive(Clone)]
  @@ -252,6 +253,19 @@ impl TxPoolController {
  })?;
  response.recv().map_err(Into::into)
  }
  +
  + pub fn clear_pool(&self) -> Result<(), FailureError> {
  + let mut sender = self.sender.clone();
  + let (responder, response) = crossbeam_channel::bounded(1);
  + let request = Request::call((), responder);
  + sender
  + .try_send(Message::ClearPool(request))
  + response.recv().map_err(Into::into)
  + .map_err(|e| {
  + let (_m, e) = handle_try_send_error(e);
  + e.into()
  + })
  + }
  }
  pub struct TxPoolServiceBuilder {
  @@ -485,5 +499,9 @@ async fn process(service: TxPoolService, message: Message) {
  error!("responder send plug_entry failed {:?}", e);
  };
  }
  + Message::ClearPool(Request { responder, .. }) => {
  + let mut tx_pool = service.tx_pool.write().await;
  + tx_pool.clear_pool();
  + }
  }
  }
  