Skip to content
Snippets Groups Projects
Unverified Commit 71af68e3 authored by bgallois's avatar bgallois
Browse files

fix #221

parent a3273d23
No related branches found
No related tags found
No related merge requests found
Pipeline #36904 waiting for manual action
...@@ -42,12 +42,6 @@ where ...@@ -42,12 +42,6 @@ where
Backend: sc_client_api::Backend<B>, Backend: sc_client_api::Backend<B>,
IdtyIndex: Decode + Encode + PartialEq + TypeInfo, IdtyIndex: Decode + Encode + PartialEq + TypeInfo,
{ {
let &[owner_key] = owner_keys else {
log::error!("🧙 [distance oracle] Expected exactly one Babe owner key, found {}: oracle cannot work", owner_keys.len());
return Ok(sp_distance::InherentDataProvider::<IdtyIndex>::new(None));
};
let owner_key = sp_runtime::AccountId32::new(owner_key.0);
let pool_index = client let pool_index = client
.storage( .storage(
parent, parent,
...@@ -82,7 +76,14 @@ where ...@@ -82,7 +76,14 @@ where
}); });
// Have we already published a result for this period? // Have we already published a result for this period?
if published_results.evaluators.contains(&owner_key) { // The block author is guaranteed to be in the owner_keys.
let owner_keys: Vec<sp_runtime::AccountId32> = owner_keys
.iter()
.map(|&key| sp_runtime::AccountId32::new(key.0))
.filter(|key| published_results.evaluators.contains(key))
.collect();
if !owner_keys.is_empty() {
log::debug!("🧙 [distance oracle] Already published a result for this period"); log::debug!("🧙 [distance oracle] Already published a result for this period");
return Ok(sp_distance::InherentDataProvider::<IdtyIndex>::new(None)); return Ok(sp_distance::InherentDataProvider::<IdtyIndex>::new(None));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment