mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
State pruning (#216)
* Started work on state db * Updated for a new hash type * Pruning and tests * Generalize on the block hash/key type * Integrate with the client backend * Merge w master * CLI options * Updated for light client refactoring * Used IntoIterator * Fixed invalid input hadling
This commit is contained in:
committed by
Gav Wood
parent
e263c8cf5d
commit
b4a0140c6d
@@ -75,6 +75,11 @@ args:
|
||||
value_name: CHAIN_SPEC
|
||||
help: Specify the chain specification (one of dev, local or poc-2)
|
||||
takes_value: true
|
||||
- pruning:
|
||||
long: pruning
|
||||
value_name: PRUNING_MODE
|
||||
help: Specify the pruning mode. (a number of blocks to keep or "archive"). Default is 256.
|
||||
takes_value: true
|
||||
- name:
|
||||
long: name
|
||||
value_name: NAME
|
||||
|
||||
@@ -28,5 +28,10 @@ error_chain! {
|
||||
Client(client::error::Error, client::error::ErrorKind) #[doc="Client error"];
|
||||
}
|
||||
errors {
|
||||
/// Input error.
|
||||
Input(m: String) {
|
||||
description("Invalid input"),
|
||||
display("{}", m),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ use polkadot_primitives::Block;
|
||||
use futures::sync::mpsc;
|
||||
use futures::{Sink, Future, Stream};
|
||||
use tokio_core::reactor;
|
||||
use service::PruningMode;
|
||||
|
||||
const DEFAULT_TELEMETRY_URL: &str = "ws://telemetry.polkadot.io:1024";
|
||||
|
||||
@@ -189,6 +190,12 @@ pub fn run<I, T>(args: I) -> error::Result<()> where
|
||||
.into();
|
||||
|
||||
config.database_path = db_path(&base_path).to_string_lossy().into();
|
||||
config.pruning = match matches.value_of("pruning") {
|
||||
Some("archive") => PruningMode::ArchiveAll,
|
||||
None => PruningMode::keep_blocks(256),
|
||||
Some(s) => PruningMode::keep_blocks(s.parse()
|
||||
.map_err(|_| error::ErrorKind::Input("Invalid pruning mode specified".to_owned()))?),
|
||||
};
|
||||
|
||||
let (mut genesis_storage, boot_nodes) = PresetConfig::from_spec(chain_spec)
|
||||
.map(PresetConfig::deconstruct)
|
||||
|
||||
Reference in New Issue
Block a user