pass engine to snapshot service
This commit is contained in:
parent
94302f3f61
commit
53b479fb7a
@ -32,7 +32,6 @@ use engines::Engine;
|
|||||||
use error::Error;
|
use error::Error;
|
||||||
use ids::BlockID;
|
use ids::BlockID;
|
||||||
use service::ClientIoMessage;
|
use service::ClientIoMessage;
|
||||||
use spec::Spec;
|
|
||||||
|
|
||||||
use io::IoChannel;
|
use io::IoChannel;
|
||||||
|
|
||||||
@ -82,6 +81,7 @@ struct Restoration {
|
|||||||
struct RestorationParams<'a> {
|
struct RestorationParams<'a> {
|
||||||
manifest: ManifestData, // manifest to base restoration on.
|
manifest: ManifestData, // manifest to base restoration on.
|
||||||
pruning: Algorithm, // pruning algorithm for the database.
|
pruning: Algorithm, // pruning algorithm for the database.
|
||||||
|
engine: Arc<Engine>, // consensus engine of the chain.
|
||||||
db_path: PathBuf, // database path
|
db_path: PathBuf, // database path
|
||||||
db_config: &'a DatabaseConfig, // configuration for the database.
|
db_config: &'a DatabaseConfig, // configuration for the database.
|
||||||
writer: Option<LooseWriter>, // writer for recovered snapshot.
|
writer: Option<LooseWriter>, // writer for recovered snapshot.
|
||||||
@ -100,7 +100,7 @@ impl Restoration {
|
|||||||
let raw_db = Arc::new(try!(Database::open(params.db_config, &*params.db_path.to_string_lossy())
|
let raw_db = Arc::new(try!(Database::open(params.db_config, &*params.db_path.to_string_lossy())
|
||||||
.map_err(UtilError::SimpleString)));
|
.map_err(UtilError::SimpleString)));
|
||||||
|
|
||||||
let chain = BlockChain::new(Default::default(), params.genesis, raw_db.clone(), Spec::new_null().engine);
|
let chain = BlockChain::new(Default::default(), params.genesis, raw_db.clone(), params.engine);
|
||||||
let blocks = try!(BlockRebuilder::new(chain, raw_db.clone(), &manifest));
|
let blocks = try!(BlockRebuilder::new(chain, raw_db.clone(), &manifest));
|
||||||
|
|
||||||
let root = manifest.state_root.clone();
|
let root = manifest.state_root.clone();
|
||||||
@ -421,6 +421,7 @@ impl Service {
|
|||||||
let params = RestorationParams {
|
let params = RestorationParams {
|
||||||
manifest: manifest,
|
manifest: manifest,
|
||||||
pruning: self.pruning,
|
pruning: self.pruning,
|
||||||
|
engine: self.engine.clone(),
|
||||||
db_path: self.restoration_db(),
|
db_path: self.restoration_db(),
|
||||||
db_config: &self.db_config,
|
db_config: &self.db_config,
|
||||||
writer: writer,
|
writer: writer,
|
||||||
|
Loading…
Reference in New Issue
Block a user