|
|
@ -6,13 +6,10 @@ use optics_core::{ |
|
|
|
traits::{ChainCommunicationError, Common, Home}, |
|
|
|
traits::{ChainCommunicationError, Common, Home}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
use rocksdb::DB; |
|
|
|
use rocksdb::DB; |
|
|
|
use std::{ops::Range, sync::Arc, time::Duration}; |
|
|
|
use std::{ops::Range, sync::Arc}; |
|
|
|
use tokio::{ |
|
|
|
use tokio::sync::{ |
|
|
|
sync::{ |
|
|
|
oneshot::{error::TryRecvError, Receiver}, |
|
|
|
oneshot::{error::TryRecvError, Receiver}, |
|
|
|
RwLock, |
|
|
|
RwLock, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
time::sleep, |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
use tracing::{debug, info, instrument}; |
|
|
|
use tracing::{debug, info, instrument}; |
|
|
|
|
|
|
|
|
|
|
@ -133,6 +130,7 @@ impl ProverSync { |
|
|
|
// expensive and poorly done
|
|
|
|
// expensive and poorly done
|
|
|
|
async fn get_leaf_range(&mut self, range: Range<usize>) -> Result<Vec<H256>, ProverSyncError> { |
|
|
|
async fn get_leaf_range(&mut self, range: Range<usize>) -> Result<Vec<H256>, ProverSyncError> { |
|
|
|
let mut leaves = vec![]; |
|
|
|
let mut leaves = vec![]; |
|
|
|
|
|
|
|
|
|
|
|
for i in range { |
|
|
|
for i in range { |
|
|
|
let leaf = self.fetch_leaf(i).await?; |
|
|
|
let leaf = self.fetch_leaf(i).await?; |
|
|
|
if leaf.is_none() { |
|
|
|
if leaf.is_none() { |
|
|
@ -293,8 +291,6 @@ impl ProverSync { |
|
|
|
info!("ProverSync: Parent task has shut down."); |
|
|
|
info!("ProverSync: Parent task has shut down."); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sleep(Duration::from_secs(2)).await; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
|