Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions light-client-bin/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,17 +135,12 @@ impl BlockFilterRpc for BlockFilterRpcImpl {
scripts: Vec<ScriptStatus>,
command: Option<SetScriptsCommand>,
) -> Result<()> {
let (tx, rx) = std::sync::mpsc::channel();
let swc = self.swc.clone();
std::thread::spawn(move || {
let mut matched_blocks = swc.matched_blocks().blocking_write();
let scripts = scripts.into_iter().map(Into::into).collect();
swc.storage()
.update_filter_scripts(scripts, command.map(Into::into).unwrap_or_default());
matched_blocks.clear();
tx.send(()).unwrap();
});
rx.recv().unwrap();
let mut matched_blocks = self.swc.matched_blocks().blocking_write();
let scripts = scripts.into_iter().map(Into::into).collect();
self.swc
.storage()
.update_filter_scripts(scripts, command.map(Into::into).unwrap_or_default());
matched_blocks.clear();
Ok(())
}

Expand Down