mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
Offchain-worker: Make it possible to disable http support (#10087)
* Offchain-worker: Make it possible to disable http support If a chain doesn't require http support in its offchain workers, this pr enables them to disable the http support. * Switch to bitflags * Use Capabilities * Update client/offchain/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> * Fix test * Update client/offchain/src/lib.rs Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com> Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
This commit is contained in:
@@ -298,9 +298,9 @@ impl AsyncApi {
|
||||
pub fn new(
|
||||
network_provider: Arc<dyn NetworkProvider + Send + Sync>,
|
||||
is_validator: bool,
|
||||
shared_client: SharedClient,
|
||||
shared_http_client: SharedClient,
|
||||
) -> (Api, Self) {
|
||||
let (http_api, http_worker) = http::http(shared_client);
|
||||
let (http_api, http_worker) = http::http(shared_http_client);
|
||||
|
||||
let api = Api { network_provider, is_validator, http: http_api };
|
||||
|
||||
@@ -310,10 +310,8 @@ impl AsyncApi {
|
||||
}
|
||||
|
||||
/// Run a processing task for the API
|
||||
pub fn process(mut self) -> impl Future<Output = ()> {
|
||||
let http = self.http.take().expect("Take invoked only once.");
|
||||
|
||||
http
|
||||
pub fn process(self) -> impl Future<Output = ()> {
|
||||
self.http.expect("`process` is only called once; qed")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +326,7 @@ mod tests {
|
||||
time::SystemTime,
|
||||
};
|
||||
|
||||
struct TestNetwork();
|
||||
pub(super) struct TestNetwork();
|
||||
|
||||
impl NetworkProvider for TestNetwork {
|
||||
fn set_authorized_peers(&self, _peers: HashSet<PeerId>) {
|
||||
|
||||
Reference in New Issue
Block a user