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 26, 2024
1 parent 7de9e07 commit d72bdc5
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 @@ -303,22 +303,8 @@ impl<N: Network> RemoteDataStore<N> {

impl<N: Network> DataStoreReadOps for RemoteDataStore<N> {
fn get<T: Deserialize>(&self, key: &KeyNibbles) -> Option<T> {

Check warning on line 305 in consensus/src/consensus/remote_data_store.rs

View workflow job for this annotation

GitHub Actions / Clippy Report

unused variable: `key`

warning: unused variable: `key` --> consensus/src/consensus/remote_data_store.rs:305:35 | 305 | fn get<T: Deserialize>(&self, key: &KeyNibbles) -> Option<T> { | ^^^ help: if this is intentional, prefix it with an underscore: `_key` | = note: `#[warn(unused_variables)]` on by default
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 d72bdc5

Please sign in to comment.