[PAN-3084][BESU-71] Enable pruning by default for fast sync and validate conflicts with privacy (#172)

Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
pull/184/head
Ratan Rai Sur 5 years ago committed by GitHub
parent 8b6cc6493a
commit 0a27885b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 47
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  2. 2
      besu/src/main/java/org/hyperledger/besu/cli/DefaultCommandValues.java
  3. 72
      besu/src/main/java/org/hyperledger/besu/cli/options/PrunerOptions.java
  4. 46
      besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
  5. 57
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  6. 5
      besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java
  7. 40
      besu/src/test/java/org/hyperledger/besu/cli/options/PrunerOptionsTest.java
  8. 19
      ethereum/core/src/integration-test/java/org/hyperledger/besu/ethereum/worldstate/PrunerIntegrationTest.java
  9. 10
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/Pruner.java
  10. 11
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/PrunerConfiguration.java
  11. 14
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/worldstate/PrunerTest.java

@ -45,6 +45,7 @@ import org.hyperledger.besu.cli.error.BesuExceptionHandler;
import org.hyperledger.besu.cli.options.EthProtocolOptions;
import org.hyperledger.besu.cli.options.MetricsCLIOptions;
import org.hyperledger.besu.cli.options.NetworkingOptions;
import org.hyperledger.besu.cli.options.PrunerOptions;
import org.hyperledger.besu.cli.options.SynchronizerOptions;
import org.hyperledger.besu.cli.options.TransactionPoolOptions;
import org.hyperledger.besu.cli.subcommands.PasswordSubCommand;
@ -86,7 +87,6 @@ import org.hyperledger.besu.ethereum.permissioning.PermissioningConfigurationBui
import org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningConfiguration;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.worldstate.PruningConfiguration;
import org.hyperledger.besu.metrics.BesuMetricCategory;
import org.hyperledger.besu.metrics.MetricCategoryRegistryImpl;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
@ -185,6 +185,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
final EthProtocolOptions ethProtocolOptions = EthProtocolOptions.create();
final MetricsCLIOptions metricsCLIOptions = MetricsCLIOptions.create();
final TransactionPoolOptions transactionPoolOptions = TransactionPoolOptions.create();
final PrunerOptions prunerOptions = PrunerOptions.create();
private final RunnerBuilder runnerBuilder;
private final BesuController.Builder controllerBuilderFactory;
private final BesuPluginContextImpl besuPluginContext;
@ -588,24 +589,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
@Option(
names = {"--pruning-enabled"},
description =
"Enable pruning of world state of blocks older than the retention period (default: ${DEFAULT-VALUE})")
private final Boolean isPruningEnabled = false;
@Option(
names = {"--pruning-blocks-retained"},
hidden = true,
description =
"Minimum number of recent blocks for which to keep entire world state (default: ${DEFAULT-VALUE})",
arity = "1")
private final Long pruningBlocksRetained = DEFAULT_PRUNING_BLOCKS_RETAINED;
@Option(
names = {"--pruning-block-confirmations"},
hidden = true,
description =
"Minimum number of confirmations on a block before marking begins (default: ${DEFAULT-VALUE})",
arity = "1")
private final Long pruningBlockConfirmations = DEFAULT_PRUNING_BLOCK_CONFIRMATIONS;
"Enable disk-space saving optimization that removes old state that is unlikely to be required (default: true if fast sync is enabled, false otherwise)")
private Boolean pruningOverride;
@Option(
names = {"--permissions-nodes-config-file-enabled"},
@ -870,6 +855,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.put("P2P Network", networkingOptions)
.put("Synchronizer", synchronizerOptions)
.put("TransactionPool", transactionPoolOptions)
.put("Pruner", prunerOptions)
.build();
UnstableOptionsSubCommand.createUnstableOptions(commandLine, unstableOptions);
@ -1006,13 +992,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
"--sync-mode",
!SyncMode.FAST.equals(syncMode),
singletonList("--fast-sync-min-peers"));
CommandLineUtils.checkOptionDependencies(
logger,
commandLine,
"--pruning-enabled",
!isPruningEnabled,
asList("--pruning-block-confirmations", "--pruning-blocks-retained"));
}
private BesuCommand configure() throws Exception {
@ -1087,8 +1066,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.clock(Clock.systemUTC())
.isRevertReasonEnabled(isRevertReasonEnabled)
.storageProvider(keyStorageProvider(keyValueStorageName))
.isPruningEnabled(isPruningEnabled)
.pruningConfiguration(buildPruningConfiguration())
.isPruningEnabled(isPruningEnabled())
.pruningConfiguration(prunerOptions.toDomainObject())
.genesisConfigOverrides(genesisConfigOverrides)
.targetGasLimit(targetGasLimit == null ? Optional.empty() : Optional.of(targetGasLimit))
.requiredBlocks(requiredBlocks);
@ -1325,6 +1304,14 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
final PrivacyParameters.Builder privacyParametersBuilder = new PrivacyParameters.Builder();
if (isPrivacyEnabled) {
final String errorSuffix = "cannot be enabled with privacy.";
if (syncMode == SyncMode.FAST) {
throw new ParameterException(commandLine, String.format("%s %s", "Fast sync", errorSuffix));
}
if (isPruningEnabled()) {
throw new ParameterException(commandLine, String.format("%s %s", "Pruning", errorSuffix));
}
privacyParametersBuilder.setEnabled(true);
privacyParametersBuilder.setEnclaveUrl(privacyUrl);
if (privacyPublicKeyFile() != null) {
@ -1370,8 +1357,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.build();
}
private PruningConfiguration buildPruningConfiguration() {
return new PruningConfiguration(pruningBlockConfirmations, pruningBlocksRetained);
private boolean isPruningEnabled() {
return Optional.ofNullable(pruningOverride).orElse(syncMode == SyncMode.FAST);
}
// Blockchain synchronisation from peers.

@ -45,8 +45,6 @@ public interface DefaultCommandValues {
String MANDATORY_NETWORK_FORMAT_HELP = "<NETWORK>";
String MANDATORY_NODE_ID_FORMAT_HELP = "<NODEID>";
Wei DEFAULT_MIN_TRANSACTION_GAS_PRICE = Wei.of(1000);
long DEFAULT_PRUNING_BLOCKS_RETAINED = 1024;
long DEFAULT_PRUNING_BLOCK_CONFIRMATIONS = 10;
BytesValue DEFAULT_EXTRA_DATA = BytesValue.EMPTY;
long DEFAULT_MAX_REFRESH_DELAY = 3600000;
long DEFAULT_MIN_REFRESH_DELAY = 1;

@ -0,0 +1,72 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.cli.options;
import org.hyperledger.besu.ethereum.worldstate.PrunerConfiguration;
import java.util.Arrays;
import java.util.List;
import picocli.CommandLine;
public class PrunerOptions implements CLIOptions<PrunerConfiguration> {
private static final String BLOCKS_RETAINED_FLAG = "--Xpruning-blocks-retained";
private static final String BLOCK_CONFIRMATIONS_FLAG = "--Xpruning-block-confirmations";
@CommandLine.Option(
names = {BLOCKS_RETAINED_FLAG},
hidden = true,
defaultValue = "1024",
paramLabel = "<INTEGER>",
description =
"Minimum number of recent blocks for which to keep entire world state (default: ${DEFAULT-VALUE})",
arity = "1")
private long pruningBlocksRetained = PrunerConfiguration.DEFAULT_PRUNING_BLOCKS_RETAINED;
@CommandLine.Option(
names = {BLOCK_CONFIRMATIONS_FLAG},
defaultValue = "10",
hidden = true,
paramLabel = "<INTEGER>",
description =
"Minimum number of confirmations on a block before marking begins (default: ${DEFAULT-VALUE})",
arity = "1")
private long pruningBlockConfirmations = PrunerConfiguration.DEFAULT_PRUNING_BLOCK_CONFIRMATIONS;
public static PrunerOptions create() {
return new PrunerOptions();
}
@Override
public PrunerConfiguration toDomainObject() {
return new PrunerConfiguration(pruningBlockConfirmations, pruningBlocksRetained);
}
public static PrunerOptions fromDomainObject(final PrunerConfiguration prunerConfiguration) {
final PrunerOptions prunerOptions = new PrunerOptions();
prunerOptions.pruningBlockConfirmations = prunerConfiguration.getBlockConfirmations();
prunerOptions.pruningBlocksRetained = prunerConfiguration.getBlocksRetained();
return prunerOptions;
}
@Override
public List<String> getCLIOptions() {
return Arrays.asList(
BLOCKS_RETAINED_FLAG,
String.valueOf(pruningBlocksRetained),
BLOCK_CONFIRMATIONS_FLAG,
String.valueOf(pruningBlockConfirmations));
}
}

@ -15,7 +15,6 @@
package org.hyperledger.besu.controller;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static org.hyperledger.besu.controller.KeyPairUtil.loadKeyPair;
import org.hyperledger.besu.config.GenesisConfigFile;
@ -49,7 +48,7 @@ import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.worldstate.MarkSweepPruner;
import org.hyperledger.besu.ethereum.worldstate.Pruner;
import org.hyperledger.besu.ethereum.worldstate.PruningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.PrunerConfiguration;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
@ -66,7 +65,12 @@ import java.util.Map;
import java.util.Optional;
import java.util.OptionalLong;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public abstract class BesuControllerBuilder<C> {
private static final Logger LOG = LogManager.getLogger();
protected GenesisConfigFile genesisConfig;
SynchronizerConfiguration syncConfig;
EthProtocolConfiguration ethereumWireProtocolConfiguration;
@ -82,7 +86,7 @@ public abstract class BesuControllerBuilder<C> {
GasLimitCalculator gasLimitCalculator;
private StorageProvider storageProvider;
private boolean isPruningEnabled;
private PruningConfiguration pruningConfiguration;
private PrunerConfiguration prunerConfiguration;
Map<String, String> genesisConfigOverrides;
private Map<Long, Hash> requiredBlocks = Collections.emptyMap();
@ -160,14 +164,14 @@ public abstract class BesuControllerBuilder<C> {
return this;
}
public BesuControllerBuilder<C> isPruningEnabled(final boolean pruningEnabled) {
this.isPruningEnabled = pruningEnabled;
public BesuControllerBuilder<C> isPruningEnabled(final boolean isPruningEnabled) {
this.isPruningEnabled = isPruningEnabled;
return this;
}
public BesuControllerBuilder<C> pruningConfiguration(
final PruningConfiguration pruningConfiguration) {
this.pruningConfiguration = pruningConfiguration;
final PrunerConfiguration prunerConfiguration) {
this.prunerConfiguration = prunerConfiguration;
return this;
}
@ -219,19 +223,21 @@ public abstract class BesuControllerBuilder<C> {
Optional<Pruner> maybePruner = Optional.empty();
if (isPruningEnabled) {
checkState(
storageProvider.isWorldStateIterable(),
"Cannot enable pruning with current database version. Resync to get the latest version.");
maybePruner =
Optional.of(
new Pruner(
new MarkSweepPruner(
protocolContext.getWorldStateArchive().getWorldStateStorage(),
blockchain,
storageProvider.createPruningStorage(),
metricsSystem),
blockchain,
pruningConfiguration));
if (!storageProvider.isWorldStateIterable()) {
LOG.warn(
"Cannot enable pruning with current database version. Disabling. Resync to get the latest database version or disable pruning explicitly on the command line to remove this warning.");
} else {
maybePruner =
Optional.of(
new Pruner(
new MarkSweepPruner(
protocolContext.getWorldStateArchive().getWorldStateStorage(),
blockchain,
storageProvider.createPruningStorage(),
metricsSystem),
blockchain,
prunerConfiguration));
}
}
final boolean fastSyncEnabled = syncConfig.getSyncMode().equals(SyncMode.FAST);

@ -56,7 +56,7 @@ import org.hyperledger.besu.ethereum.p2p.peers.EnodeURL;
import org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.permissioning.SmartContractPermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.PruningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.PrunerConfiguration;
import org.hyperledger.besu.metrics.StandardMetricCategory;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatMethod;
@ -2329,8 +2329,8 @@ public class BesuCommandTest extends CommandTestAbstract {
}
@Test
public void pruningIsEnabledWhenSpecified() throws Exception {
parseCommand("--pruning-enabled");
public void pruningIsEnabledIfSyncModeIsFast() {
parseCommand("--sync-mode", "FAST");
verify(mockControllerBuilder).isPruningEnabled(true);
verify(mockControllerBuilder).build();
@ -2340,12 +2340,33 @@ public class BesuCommandTest extends CommandTestAbstract {
}
@Test
public void pruningOptionsRequiresServiceToBeEnabled() {
public void pruningIsDisabledIfSyncModeIsFull() {
parseCommand("--sync-mode", "FULL");
parseCommand("--pruning-blocks-retained", "4", "--pruning-block-confirmations", "1");
verify(mockControllerBuilder).isPruningEnabled(false);
verify(mockControllerBuilder).build();
verifyOptionsConstraintLoggerCall(
"--pruning-enabled", "--pruning-blocks-retained", "--pruning-block-confirmations");
assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
}
@Test
public void pruningEnabledExplicitly() {
parseCommand("--pruning-enabled", "--sync-mode=FULL");
verify(mockControllerBuilder).isPruningEnabled(true);
verify(mockControllerBuilder).build();
assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
}
@Test
public void pruningDisabledExplicitly() {
parseCommand("--pruning-enabled=false", "--sync-mode=FAST");
verify(mockControllerBuilder).isPruningEnabled(false);
verify(mockControllerBuilder).build();
assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
@ -2354,10 +2375,10 @@ public class BesuCommandTest extends CommandTestAbstract {
@Test
public void pruningParametersAreCaptured() throws Exception {
parseCommand(
"--pruning-enabled", "--pruning-blocks-retained=15", "--pruning-block-confirmations=4");
"--pruning-enabled", "--Xpruning-blocks-retained=15", "--Xpruning-block-confirmations=4");
final ArgumentCaptor<PruningConfiguration> pruningArg =
ArgumentCaptor.forClass(PruningConfiguration.class);
final ArgumentCaptor<PrunerConfiguration> pruningArg =
ArgumentCaptor.forClass(PrunerConfiguration.class);
verify(mockControllerBuilder).pruningConfiguration(pruningArg.capture());
verify(mockControllerBuilder).build();
@ -2682,6 +2703,22 @@ public class BesuCommandTest extends CommandTestAbstract {
assertThat(commandOutput.toString()).isEmpty();
}
@Test
public void privacyWithFastSyncMustError() {
parseCommand("--sync-mode=FAST", "--privacy-enabled");
assertThat(commandErrorOutput.toString()).contains("Fast sync cannot be enabled with privacy.");
assertThat(commandOutput.toString()).isEmpty();
}
@Test
public void privacyWithPruningMustError() {
parseCommand("--pruning-enabled", "--privacy-enabled");
assertThat(commandErrorOutput.toString()).contains("Pruning cannot be enabled with privacy.");
assertThat(commandOutput.toString()).isEmpty();
}
@Test
public void rpcHttpAuthCredentialsFileOptionDisabledUnderDocker() {
System.setProperty("besu.docker", "true");

@ -32,6 +32,7 @@ import org.hyperledger.besu.cli.config.EthNetworkConfig;
import org.hyperledger.besu.cli.options.EthProtocolOptions;
import org.hyperledger.besu.cli.options.MetricsCLIOptions;
import org.hyperledger.besu.cli.options.NetworkingOptions;
import org.hyperledger.besu.cli.options.PrunerOptions;
import org.hyperledger.besu.cli.options.SynchronizerOptions;
import org.hyperledger.besu.cli.options.TransactionPoolOptions;
import org.hyperledger.besu.cli.subcommands.PublicKeySubCommand;
@ -332,6 +333,10 @@ public abstract class CommandTestAbstract {
return synchronizerOptions;
}
public PrunerOptions getPrunerOptions() {
return prunerOptions;
}
public EthProtocolOptions getEthProtocolOptions() {
return ethProtocolOptions;
}

@ -0,0 +1,40 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.cli.options;
import org.hyperledger.besu.ethereum.worldstate.PrunerConfiguration;
public class PrunerOptionsTest extends AbstractCLIOptionsTest<PrunerConfiguration, PrunerOptions> {
@Override
PrunerConfiguration createDefaultDomainObject() {
return PrunerConfiguration.getDefault();
}
@Override
PrunerConfiguration createCustomizedDomainObject() {
return new PrunerConfiguration(4, 10);
}
@Override
PrunerOptions optionsFromDomainObject(final PrunerConfiguration domainObject) {
return PrunerOptions.fromDomainObject(domainObject);
}
@Override
PrunerOptions getOptionsFromBesuCommand(final TestBesuCommand besuCommand) {
return besuCommand.getPrunerOptions();
}
}

@ -64,42 +64,41 @@ public class PrunerIntegrationTest {
private final MutableBlockchain blockchain = createInMemoryBlockchain(genesisBlock);
@Test
public void pruner_smallState_manyOpsPerTx() throws InterruptedException {
public void pruner_smallState_manyOpsPerTx() {
testPruner(3, 1, 1, 4, 1000);
}
@Test
public void pruner_largeState_fewOpsPerTx() throws InterruptedException {
public void pruner_largeState_fewOpsPerTx() {
testPruner(2, 5, 5, 6, 5);
}
@Test
public void pruner_emptyBlocks() throws InterruptedException {
public void pruner_emptyBlocks() {
testPruner(5, 0, 2, 5, 10);
}
@Test
public void pruner_markChainhead() throws InterruptedException {
public void pruner_markChainhead() {
testPruner(4, 2, 1, 10, 20);
}
@Test
public void pruner_lowRelativeBlockConfirmations() throws InterruptedException {
public void pruner_lowRelativeBlockConfirmations() {
testPruner(3, 2, 1, 4, 20);
}
@Test
public void pruner_highRelativeBlockConfirmations() throws InterruptedException {
public void pruner_highRelativeBlockConfirmations() {
testPruner(3, 2, 9, 10, 20);
}
private void testPruner(
final int numCycles,
final int accountsPerBlock,
final long blockConfirmations,
final int blockConfirmations,
final int numBlocksToKeep,
final int opsPerTransaction)
throws InterruptedException {
final int opsPerTransaction) {
final var markSweepPruner =
new MarkSweepPruner(
@ -108,7 +107,7 @@ public class PrunerIntegrationTest {
new Pruner(
markSweepPruner,
blockchain,
new PruningConfiguration(blockConfirmations, numBlocksToKeep),
new PrunerConfiguration(blockConfirmations, numBlocksToKeep),
MockExecutorService::new);
pruner.start();

@ -54,13 +54,13 @@ public class Pruner {
Pruner(
final MarkSweepPruner pruningStrategy,
final Blockchain blockchain,
final PruningConfiguration pruningConfiguration,
final PrunerConfiguration prunerConfiguration,
final Supplier<ExecutorService> executorServiceSupplier) {
this.pruningStrategy = pruningStrategy;
this.blockchain = blockchain;
this.executorServiceSupplier = executorServiceSupplier;
this.blocksRetained = pruningConfiguration.getBlocksRetained();
this.blockConfirmations = pruningConfiguration.getBlockConfirmations();
this.blocksRetained = prunerConfiguration.getBlocksRetained();
this.blockConfirmations = prunerConfiguration.getBlockConfirmations();
checkArgument(
blockConfirmations >= 0 && blockConfirmations < blocksRetained,
"blockConfirmations and blocksRetained must be non-negative. blockConfirmations must be less than blockRetained.");
@ -69,8 +69,8 @@ public class Pruner {
public Pruner(
final MarkSweepPruner pruningStrategy,
final Blockchain blockchain,
final PruningConfiguration pruningConfiguration) {
this(pruningStrategy, blockchain, pruningConfiguration, getDefaultExecutorSupplier());
final PrunerConfiguration prunerConfiguration) {
this(pruningStrategy, blockchain, prunerConfiguration, getDefaultExecutorSupplier());
}
private static Supplier<ExecutorService> getDefaultExecutorSupplier() {

@ -14,17 +14,24 @@
*/
package org.hyperledger.besu.ethereum.worldstate;
public class PruningConfiguration {
public class PrunerConfiguration {
public static final long DEFAULT_PRUNING_BLOCKS_RETAINED = 1024;
public static final long DEFAULT_PRUNING_BLOCK_CONFIRMATIONS = 10;
private final long blocksRetainedBeforeSweeping;
private final long blockConfirmationsBeforeMarking;
public PruningConfiguration(
public PrunerConfiguration(
final long blockConfirmationsBeforeMarking, final long blocksRetainedBeforeSweeping) {
this.blockConfirmationsBeforeMarking = blockConfirmationsBeforeMarking;
this.blocksRetainedBeforeSweeping = blocksRetainedBeforeSweeping;
}
public static PrunerConfiguration getDefault() {
return new PrunerConfiguration(
DEFAULT_PRUNING_BLOCK_CONFIRMATIONS, DEFAULT_PRUNING_BLOCKS_RETAINED);
}
public long getBlocksRetained() {
return blocksRetainedBeforeSweeping;
}

@ -69,7 +69,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
blockchain,
new PruningConfiguration(0, 1),
new PrunerConfiguration(0, 1),
mockExecutorServiceSupplier);
pruner.start();
@ -94,7 +94,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
blockchain,
new PruningConfiguration(1, 2),
new PrunerConfiguration(1, 2),
mockExecutorServiceSupplier);
pruner.start();
@ -125,7 +125,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
blockchain,
new PruningConfiguration(0, 1),
new PrunerConfiguration(0, 1),
mockExecutorServiceSupplier);
pruner.start();
@ -165,7 +165,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
mockchain,
new PruningConfiguration(-1, -2),
new PrunerConfiguration(-1, -2),
mockExecutorServiceSupplier))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(
@ -173,7 +173,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
mockchain,
new PruningConfiguration(10, 8),
new PrunerConfiguration(10, 8),
mockExecutorServiceSupplier))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(
@ -181,7 +181,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
mockchain,
new PruningConfiguration(10, 10),
new PrunerConfiguration(10, 10),
mockExecutorServiceSupplier))
.isInstanceOf(IllegalArgumentException.class);
}
@ -198,7 +198,7 @@ public class PrunerTest {
new Pruner(
markSweepPruner,
blockchain,
new PruningConfiguration(0, 1),
new PrunerConfiguration(0, 1),
mockExecutorServiceSupplier);
pruner.start();
pruner.stop();

Loading…
Cancel
Save