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

fix #221

parent 815fb0d1
No related branches found
No related tags found
No related merge requests found
Pipeline #36684 passed
......@@ -42,12 +42,6 @@ where
Backend: sc_client_api::Backend<B>,
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
.storage(
parent,
......@@ -82,7 +76,14 @@ where
});
// 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");
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