Unverified Commit c0e9a209 authored by Arkadiy Paronyan's avatar Arkadiy Paronyan Committed by GitHub
Browse files

Updated for the new db (#996)

* Updated for the new db

* Bumped version

* Sort out features

* Update to substrate master
parent 13ec3023
Pipeline #88019 passed with stages
in 29 minutes and 28 seconds
This diff is collapsed.
......@@ -39,9 +39,9 @@ browser-utils = { package = "substrate-browser-utils", git = "https://github.com
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
[features]
default = [ "wasmtime", "rocksdb", "cli" ]
default = [ "wasmtime", "db", "cli" ]
wasmtime = [ "sc-cli/wasmtime" ]
rocksdb = [ "service/rocksdb" ]
db = [ "service/db" ]
cli = [
"tokio",
"sc-cli",
......
......@@ -25,6 +25,7 @@ use log::trace;
use sc_network::config::{build_multiaddr, FinalityProofProvider, Role};
use sp_blockchain::{
Result as ClientResult, well_known_cache_keys::{self, Id as CacheKeyId}, Info as BlockchainInfo,
HeaderBackend,
};
use sc_client_api::{
BlockchainEvents, BlockImportNotification,
......@@ -310,8 +311,7 @@ impl<D> Peer<D> {
/// by using .info(), you should probably use it instead of this.
pub fn blockchain_canon_equals(&self, other: &Self) -> bool {
if let (Some(mine), Some(others)) = (self.backend.clone(), other.backend.clone()) {
mine.as_in_memory().blockchain()
.canon_equals_to(others.as_in_memory().blockchain())
mine.blockchain().info().best_hash == others.blockchain().info().best_hash
} else {
false
}
......@@ -320,7 +320,7 @@ impl<D> Peer<D> {
/// Count the total number of imported blocks.
pub fn blocks_count(&self) -> u64 {
self.backend.as_ref().map(
|backend| backend.blocks_count()
|backend| backend.blockchain().info().best_number as u64
).unwrap_or(0)
}
......
......@@ -61,7 +61,7 @@ polkadot-test-runtime-client = { path = "../runtime/test-runtime/client" }
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
[features]
default = ["rocksdb", "full-node"]
rocksdb = ["service/rocksdb"]
default = ["db", "full-node"]
db = ["service/db"]
runtime-benchmarks = ["polkadot-runtime/runtime-benchmarks", "kusama-runtime/runtime-benchmarks", "westend-runtime/runtime-benchmarks"]
full-node = ["av_store", "consensus", "polkadot-network"]
......@@ -363,10 +363,9 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
let is_authority = role.is_authority() && !is_collator;
let force_authoring = config.force_authoring;
let max_block_data_size = max_block_data_size;
let db_path = if let DatabaseConfig::Path { ref path, .. } = config.database {
path.clone()
} else {
return Err("Starting a Polkadot service with a custom database isn't supported".to_string().into());
let db_path = match config.database.path() {
Some(path) => std::path::PathBuf::from(path),
None => return Err("Starting a Polkadot service with a custom database isn't supported".to_string().into()),
};
let disable_grandpa = config.disable_grandpa;
let name = config.network.node_name.clone();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment