diff --git a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/RocksDbUsageHelper.java b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/RocksDbUsageHelper.java index 33f551d17f8..4068d5b7a87 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/RocksDbUsageHelper.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/RocksDbUsageHelper.java @@ -46,7 +46,7 @@ static void printUsageForColumnFamily( !totalSstFilesSize.isEmpty() && !totalSstFilesSize.isBlank() ? Long.parseLong(totalSstFilesSize) : 0; - if (sizeLong == 0 && numberOfKeysLong == 0){ + if (sizeLong == 0 && numberOfKeysLong == 0) { emptyColumnFamily = true; } diff --git a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/TrieLogHelper.java b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/TrieLogHelper.java index 31207a399e6..ef9c9f61906 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/TrieLogHelper.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/storage/TrieLogHelper.java @@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.MINIMUM_BONSAI_TRIE_LOG_RETENTION_THRESHOLD; -import org.hyperledger.besu.controller.BesuController; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.bonsai.storage.BonsaiWorldStateKeyValueStorage; import org.hyperledger.besu.ethereum.chain.Blockchain; @@ -57,7 +56,8 @@ static void prune( final PrintWriter out, final DataStorageConfiguration config, final BonsaiWorldStateKeyValueStorage rootWorldStateStorage, - final MutableBlockchain blockchain) throws IOException { + final MutableBlockchain blockchain) + throws IOException { TrieLogHelper.validatePruneConfiguration(config); final long layersToRetain = config.getUnstable().getBonsaiTrieLogRetentionThreshold(); @@ -180,34 +180,34 @@ private static void saveTrieLogsInFile(final Map trieLogs) throw File file = new File(trieLogFile); - try (BufferedWriter bf = new BufferedWriter(new FileWriter(file, StandardCharsets.UTF_8))) { - for (Map.Entry entry : trieLogs.entrySet()) { - bf.write(Bytes.of(entry.getKey()) + ":" + Base64.toBase64String(entry.getValue())); - bf.newLine(); - } - bf.flush(); - } catch (IOException e) { - LOG.error(e.getMessage()); - throw e; + try (BufferedWriter bf = new BufferedWriter(new FileWriter(file, StandardCharsets.UTF_8))) { + for (Map.Entry entry : trieLogs.entrySet()) { + bf.write(Bytes.of(entry.getKey()) + ":" + Base64.toBase64String(entry.getValue())); + bf.newLine(); } + bf.flush(); + } catch (IOException e) { + LOG.error(e.getMessage()); + throw e; + } } private static IdentityHashMap readTrieLogsFromFile() throws IOException { File file = new File(trieLogFile); IdentityHashMap trieLogs = new IdentityHashMap<>(); - try (BufferedReader br = new BufferedReader(new FileReader(file, StandardCharsets.UTF_8))) { - String line; - while ((line = br.readLine()) != null) { - List parts = Splitter.on(':').splitToList(line); - byte[] key = Bytes.fromHexString(parts.get(0)).toArrayUnsafe(); - byte[] value = Base64.decode(parts.get(1)); - trieLogs.put(key, value); - } - } catch (IOException e) { - LOG.error(e.getMessage()); - throw e; + try (BufferedReader br = new BufferedReader(new FileReader(file, StandardCharsets.UTF_8))) { + String line; + while ((line = br.readLine()) != null) { + List parts = Splitter.on(':').splitToList(line); + byte[] key = Bytes.fromHexString(parts.get(0)).toArrayUnsafe(); + byte[] value = Base64.decode(parts.get(1)); + trieLogs.put(key, value); } + } catch (IOException e) { + LOG.error(e.getMessage()); + throw e; + } return trieLogs; }