zebrad: eliminate duplicate span in sync
This commit is contained in:
parent
b5a43f4516
commit
91469faf3c
|
|
@ -506,7 +506,7 @@ where
|
||||||
// So we just download and verify the genesis block here.
|
// So we just download and verify the genesis block here.
|
||||||
while !self.state_contains(self.genesis_hash).await? {
|
while !self.state_contains(self.genesis_hash).await? {
|
||||||
self.downloads
|
self.downloads
|
||||||
.queue_download(self.genesis_hash)
|
.download_and_verify(self.genesis_hash)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| eyre!(e))?;
|
.map_err(|e| eyre!(e))?;
|
||||||
match self.downloads.next().await.expect("downloads is nonempty") {
|
match self.downloads.next().await.expect("downloads is nonempty") {
|
||||||
|
|
@ -531,7 +531,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
self.downloads
|
self.downloads
|
||||||
.queue_download(hash)
|
.download_and_verify(hash)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| eyre!(e))?;
|
.map_err(|e| eyre!(e))?;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ where
|
||||||
/// only if the network service fails. It returns immediately after queuing
|
/// only if the network service fails. It returns immediately after queuing
|
||||||
/// the request.
|
/// the request.
|
||||||
#[instrument(skip(self))]
|
#[instrument(skip(self))]
|
||||||
pub async fn queue_download(&mut self, hash: block::Hash) -> Result<(), BoxError> {
|
pub async fn download_and_verify(&mut self, hash: block::Hash) -> Result<(), BoxError> {
|
||||||
if self.cancel_handles.contains_key(&hash) {
|
if self.cancel_handles.contains_key(&hash) {
|
||||||
tracing::debug!("skipping hash already queued for download");
|
tracing::debug!("skipping hash already queued for download");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
@ -134,7 +134,6 @@ where
|
||||||
// This oneshot is used to signal cancellation to the download task.
|
// This oneshot is used to signal cancellation to the download task.
|
||||||
let (cancel_tx, mut cancel_rx) = oneshot::channel::<()>();
|
let (cancel_tx, mut cancel_rx) = oneshot::channel::<()>();
|
||||||
|
|
||||||
let span = tracing::warn_span!("block_fetch_verify", ?hash);
|
|
||||||
let mut verifier = self.verifier.clone();
|
let mut verifier = self.verifier.clone();
|
||||||
let task = tokio::spawn(
|
let task = tokio::spawn(
|
||||||
async move {
|
async move {
|
||||||
|
|
@ -170,7 +169,7 @@ where
|
||||||
|
|
||||||
verification
|
verification
|
||||||
}
|
}
|
||||||
.instrument(span)
|
.in_current_span()
|
||||||
// Tack the hash onto the error so we can remove the cancel handle
|
// Tack the hash onto the error so we can remove the cancel handle
|
||||||
// on failure as well as on success.
|
// on failure as well as on success.
|
||||||
.map_err(move |e| (e, hash)),
|
.map_err(move |e| (e, hash)),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue