Clean up lock acquisition

This commit is contained in:
Luke Parker 2022-10-25 02:45:20 -04:00
parent 9b8f2f4487
commit 5839f44290
No known key found for this signature in database
GPG key ID: F9F1386DB1E119B6

View file

@ -351,8 +351,11 @@ where
let (header, body) = block.clone().deconstruct();
let parent = *header.parent_hash();
let number = *header.number();
let mut queue_write = self.queue.write().await;
*self.importing_block.write().unwrap() = Some(hash);
self.queue.write().await.as_mut().unwrap().import_blocks(
queue_write.as_mut().unwrap().import_blocks(
// We do not want this block, which hasn't been confirmed, to be broadcast over the net
// Substrate will generate notifications unless it's Genesis, which this isn't, InitialSync,
// which changes telemtry behavior, or File, which is... close enough
@ -372,7 +375,7 @@ where
}],
);
if !ImportFuture::new(hash, self.queue.write().await.as_mut().unwrap()).await {
if !ImportFuture::new(hash, queue_write.as_mut().unwrap()).await {
todo!()
}