From d72bdc55ecd424d7504fe5b3a2aa9bbec3b39847 Mon Sep 17 00:00:00 2001 From: hrxi Date: Tue, 26 Nov 2024 23:36:10 +0100 Subject: [PATCH] Remove incorrect implementation of `DataStoreReadOps` Previously, the function would try to block the whole thread whenever requesting something from other peers. This wasn't noticed since the implementation is only used in light clients that were **NOT** compiled for WASM. I noticed this implementation when reviewing #3159, which would have caused these thread blockings to continue for longer times. --- consensus/src/consensus/remote_data_store.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/consensus/src/consensus/remote_data_store.rs b/consensus/src/consensus/remote_data_store.rs index 1bdcfee2d4..5efecc7099 100644 --- a/consensus/src/consensus/remote_data_store.rs +++ b/consensus/src/consensus/remote_data_store.rs @@ -303,22 +303,8 @@ impl RemoteDataStore { impl DataStoreReadOps for RemoteDataStore { fn get(&self, key: &KeyNibbles) -> Option { - let proof = futures_executor::block_on(Self::get_trie( - Arc::clone(&self.network), - self.blockchain.clone(), - &[key.clone()], - self.min_peers, - )) - .ok(); - if let Some(mut proof) = proof { - if proof.len() != 1 { - log::error!(len = proof.len(), "Unexpected amount of proved items"); - None - } else { - proof.remove(key).flatten() - } - } else { - None - } + unimplemented!( + "this function is not implementable: a sync function cannot call an async one", + ); } }