Rename --pruning and --keep-blocks to be more similar to one another (#11934)

* rename prunning and keep-blocks flags

* Add aliases in keep-blocks and pruning for backward compatibility

* Rename in code variables from  and  to  and
This commit is contained in:
Nikos Kontakis
2022-08-08 11:31:26 +02:00
committed by GitHub
parent a314484865
commit 20c49b20a7
16 changed files with 79 additions and 79 deletions
+4 -4
View File
@@ -676,7 +676,7 @@ pub struct FullPeerConfig {
/// Pruning window size.
///
/// NOTE: only finalized blocks are subject for removal!
pub keep_blocks: Option<u32>,
pub blocks_pruning: Option<u32>,
/// Block announce validator.
pub block_announce_validator: Option<Box<dyn BlockAnnounceValidator<Block> + Send + Sync>>,
/// List of notification protocols that the network must support.
@@ -742,10 +742,10 @@ where
/// Add a full peer.
fn add_full_peer_with_config(&mut self, config: FullPeerConfig) {
let mut test_client_builder = match (config.keep_blocks, config.storage_chain) {
(Some(keep_blocks), true) => TestClientBuilder::with_tx_storage(keep_blocks),
let mut test_client_builder = match (config.blocks_pruning, config.storage_chain) {
(Some(blocks_pruning), true) => TestClientBuilder::with_tx_storage(blocks_pruning),
(None, true) => TestClientBuilder::with_tx_storage(u32::MAX),
(Some(keep_blocks), false) => TestClientBuilder::with_pruning_window(keep_blocks),
(Some(blocks_pruning), false) => TestClientBuilder::with_pruning_window(blocks_pruning),
(None, false) => TestClientBuilder::with_default_backend(),
};
if let Some(storage) = config.extra_storage {
+1 -1
View File
@@ -544,7 +544,7 @@ fn syncs_header_only_forks() {
sp_tracing::try_init_simple();
let mut net = TestNet::new(0);
net.add_full_peer_with_config(Default::default());
net.add_full_peer_with_config(FullPeerConfig { keep_blocks: Some(3), ..Default::default() });
net.add_full_peer_with_config(FullPeerConfig { blocks_pruning: Some(3), ..Default::default() });
net.peer(0).push_blocks(2, false);
net.peer(1).push_blocks(2, false);