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 ...@@ -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" } substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
[features] [features]
default = [ "wasmtime", "rocksdb", "cli" ] default = [ "wasmtime", "db", "cli" ]
wasmtime = [ "sc-cli/wasmtime" ] wasmtime = [ "sc-cli/wasmtime" ]
rocksdb = [ "service/rocksdb" ] db = [ "service/db" ]
cli = [ cli = [
"tokio", "tokio",
"sc-cli", "sc-cli",
......
...@@ -25,6 +25,7 @@ use log::trace; ...@@ -25,6 +25,7 @@ use log::trace;
use sc_network::config::{build_multiaddr, FinalityProofProvider, Role}; use sc_network::config::{build_multiaddr, FinalityProofProvider, Role};
use sp_blockchain::{ use sp_blockchain::{
Result as ClientResult, well_known_cache_keys::{self, Id as CacheKeyId}, Info as BlockchainInfo, Result as ClientResult, well_known_cache_keys::{self, Id as CacheKeyId}, Info as BlockchainInfo,
HeaderBackend,
}; };
use sc_client_api::{ use sc_client_api::{
BlockchainEvents, BlockImportNotification, BlockchainEvents, BlockImportNotification,
...@@ -310,8 +311,7 @@ impl<D> Peer<D> { ...@@ -310,8 +311,7 @@ impl<D> Peer<D> {
/// by using .info(), you should probably use it instead of this. /// by using .info(), you should probably use it instead of this.
pub fn blockchain_canon_equals(&self, other: &Self) -> bool { pub fn blockchain_canon_equals(&self, other: &Self) -> bool {
if let (Some(mine), Some(others)) = (self.backend.clone(), other.backend.clone()) { if let (Some(mine), Some(others)) = (self.backend.clone(), other.backend.clone()) {
mine.as_in_memory().blockchain() mine.blockchain().info().best_hash == others.blockchain().info().best_hash
.canon_equals_to(others.as_in_memory().blockchain())
} else { } else {
false false
} }
...@@ -320,7 +320,7 @@ impl<D> Peer<D> { ...@@ -320,7 +320,7 @@ impl<D> Peer<D> {
/// Count the total number of imported blocks. /// Count the total number of imported blocks.
pub fn blocks_count(&self) -> u64 { pub fn blocks_count(&self) -> u64 {
self.backend.as_ref().map( self.backend.as_ref().map(
|backend| backend.blocks_count() |backend| backend.blockchain().info().best_number as u64
).unwrap_or(0) ).unwrap_or(0)
} }
......
...@@ -61,7 +61,7 @@ polkadot-test-runtime-client = { path = "../runtime/test-runtime/client" } ...@@ -61,7 +61,7 @@ polkadot-test-runtime-client = { path = "../runtime/test-runtime/client" }
sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" } sc-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master" }
[features] [features]
default = ["rocksdb", "full-node"] default = ["db", "full-node"]
rocksdb = ["service/rocksdb"] db = ["service/db"]
runtime-benchmarks = ["polkadot-runtime/runtime-benchmarks", "kusama-runtime/runtime-benchmarks", "westend-runtime/runtime-benchmarks"] runtime-benchmarks = ["polkadot-runtime/runtime-benchmarks", "kusama-runtime/runtime-benchmarks", "westend-runtime/runtime-benchmarks"]
full-node = ["av_store", "consensus", "polkadot-network"] full-node = ["av_store", "consensus", "polkadot-network"]
...@@ -363,10 +363,9 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>( ...@@ -363,10 +363,9 @@ pub fn new_full<Runtime, Dispatch, Extrinsic>(
let is_authority = role.is_authority() && !is_collator; let is_authority = role.is_authority() && !is_collator;
let force_authoring = config.force_authoring; let force_authoring = config.force_authoring;
let max_block_data_size = max_block_data_size; let max_block_data_size = max_block_data_size;
let db_path = if let DatabaseConfig::Path { ref path, .. } = config.database { let db_path = match config.database.path() {
path.clone() Some(path) => std::path::PathBuf::from(path),
} else { None => return Err("Starting a Polkadot service with a custom database isn't supported".to_string().into()),
return Err("Starting a Polkadot service with a custom database isn't supported".to_string().into());
}; };
let disable_grandpa = config.disable_grandpa; let disable_grandpa = config.disable_grandpa;
let name = config.network.node_name.clone(); 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