Skip to content
Snippets Groups Projects

Fix #221

Merged Benjamin Gallois requested to merge 221-refactor-distance-oracle into master
All threads resolved!
@@ -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));
}
}
Loading