Skip to content

Commit

Permalink
Remove incorrect implementation of DataStoreReadOps
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hrxi committed Nov 27, 2024
1 parent 94b3fc6 commit dcbe5d1
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions consensus/src/consensus/remote_data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,22 +366,8 @@ impl<N: Network> RemoteDataStore<N> {

impl<N: Network> DataStoreReadOps for RemoteDataStore<N> {
fn get<T: Deserialize>(&self, key: &KeyNibbles) -> Option<T> {
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",
);
}
}

0 comments on commit dcbe5d1

Please sign in to comment.