Skip to content

Commit

Permalink
fix TransactionStorageMode to StorageChain for db (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
atenjin authored Jun 22, 2021
1 parent 5881d8b commit e86c1c7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
11 changes: 1 addition & 10 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub use sc_cli::{DatabaseParams, KeystoreParams, SubstrateCli};
use ec_service::{
config::{
BasePath, Configuration, DatabaseConfig, KeystoreConfig, Role, RpcMethods, TaskExecutor,
TransactionPoolOptions, TransactionStorageMode,
TransactionPoolOptions,
},
TracingReceiver,
};
Expand Down Expand Up @@ -125,14 +125,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
.unwrap_or_default())
}

/// Get the database transaction storage scheme.
fn database_transaction_storage(&self) -> Result<TransactionStorageMode> {
Ok(self
.database_params()
.map(|x| x.transaction_storage())
.unwrap_or(TransactionStorageMode::BlockBody))
}

/// Get the database backend variant.
///
/// By default this is retrieved from `DatabaseParams` if it is available. Otherwise its `None`.
Expand Down Expand Up @@ -333,7 +325,6 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized {
rpc_ws_max_connections: self.rpc_ws_max_connections()?,
rpc_cors: self.rpc_cors()?,
tracing_targets: self.tracing_targets()?,
transaction_storage: self.database_transaction_storage()?,
chain_spec,
announce_block: self.announce_block()?,
role,
Expand Down
7 changes: 5 additions & 2 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ use sc_client_api::{
};
use sc_client_db::{Backend, KeepBlocks, PruningMode};
use sc_keystore::LocalKeystore;
use sc_service::{error::Error, new_db_backend, MallocSizeOfWasm, RpcExtensionBuilder};
use sc_service::{
error::Error, new_db_backend, MallocSizeOfWasm, RpcExtensionBuilder, TransactionStorageMode,
};

use ec_client_db::StateKv;
use ec_executor::{NativeExecutionDispatch, NativeExecutor, RuntimeInfo};
Expand Down Expand Up @@ -162,7 +164,8 @@ pub fn database_settings(config: &Configuration) -> sc_client_db::DatabaseSettin
state_pruning: PruningMode::ArchiveAll,
source: config.database.clone(),
keep_blocks: KeepBlocks::All,
transaction_storage: config.transaction_storage.clone(),
// we only point this StorageChain mode, do not receive BlockBody mode
transaction_storage: TransactionStorageMode::StorageChain,
}
}

Expand Down
2 changes: 0 additions & 2 deletions client/service/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ pub struct Configuration {
pub state_cache_size: usize,
/// Size in percent of cache size dedicated to child tries
pub state_cache_child_ratio: Option<usize>,
/// Transaction storage scheme.
pub transaction_storage: TransactionStorageMode,
/// Chain configuration.
pub chain_spec: Box<dyn ChainSpec>,
/// RPC over HTTP binding address. `None` if disabled.
Expand Down
2 changes: 1 addition & 1 deletion client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub use sp_utils::mpsc::{tracing_unbounded, TracingUnboundedReceiver, TracingUnb
pub use sc_service::{
build_network, error, BasePath, BuildNetworkParams, ChainSpec, ChainType, GenericChainSpec,
NoopRpcExtensionBuilder, RpcExtensionBuilder, RpcMethods, TaskType, TracingReceiver,
TransactionPoolOptions, TransactionStorageMode,
TransactionPoolOptions,
};

use crate::builder::KeystoreContainer;
Expand Down

0 comments on commit e86c1c7

Please sign in to comment.