Display has_api_with results if invalid version of Offchain Workers is detected. (#4749)

* Display error message when checking has_api.

* Cargo.lock.
This commit is contained in:
Tomasz Drwięga
2020-01-28 22:34:41 +01:00
committed by Bastian Köcher
parent 4c63766e41
commit e7df428274
2 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -107,7 +107,11 @@ impl<Client, Storage, Block> OffchainWorkers<
let version = match (has_api_v1, has_api_v2) {
(_, Ok(true)) => 2,
(Ok(true), _) => 1,
_ => 0,
err => {
let help = "Consider turning off offchain workers if they are not part of your runtime.";
log::error!("Unsupported Offchain Worker API version: {:?}. {}.", err, help);
0
}
};
debug!("Checking offchain workers at {:?}: version:{}", at, version);
if version > 0 {
@@ -140,8 +144,6 @@ impl<Client, Storage, Block> OffchainWorkers<
});
futures::future::Either::Left(runner.process())
} else {
let help = "Consider turning off offchain workers if they are not part of your runtime.";
log::error!("Unsupported Offchain Worker API version: {}. {}", version, help);
futures::future::Either::Right(futures::future::ready(()))
}
}