From f6940e5630f88d3c081e6985f37c66234d25ed95 Mon Sep 17 00:00:00 2001 From: Xin Li Date: Thu, 9 Jan 2025 13:20:15 -0600 Subject: [PATCH] code smells again Signed-off-by: Xin Li --- .../importer/reader/block/BlockRootHashDigest.java | 10 ++++------ .../importer/reader/block/ProtoBlockFileReader.java | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/BlockRootHashDigest.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/BlockRootHashDigest.java index fe766fe36a..262b34f099 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/BlockRootHashDigest.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/BlockRootHashDigest.java @@ -40,8 +40,6 @@ class BlockRootHashDigest { private static final byte[] EMPTY_HASH = createMessageDigest().digest(new byte[0]); - private static final String PREVIOUSHASH = "previousHash"; - private static final String STARTOFBLOCKSTATEHASH = "startOfBlockStateHash"; @NonFinal private boolean finalized; @@ -69,8 +67,8 @@ public String digest() { throw new IllegalStateException("Block root hash is already calculated"); } - validateHash(previousHash, PREVIOUSHASH); - validateHash(startOfBlockStateHash, STARTOFBLOCKSTATEHASH); + validateHash(previousHash, "previousHash"); + validateHash(startOfBlockStateHash, "startOfBlockStateHash"); List leaves = new ArrayList<>(); leaves.add(previousHash); @@ -85,12 +83,12 @@ public String digest() { } public void setPreviousHash(byte[] previousHash) { - validateHash(previousHash, PREVIOUSHASH); + validateHash(previousHash, "previousHash"); this.previousHash = previousHash; } public void setStartOfBlockStateHash(byte[] startOfBlockStateHash) { - validateHash(startOfBlockStateHash, STARTOFBLOCKSTATEHASH); + validateHash(startOfBlockStateHash, "startOfBlockStateHash"); this.startOfBlockStateHash = startOfBlockStateHash; } diff --git a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/ProtoBlockFileReader.java b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/ProtoBlockFileReader.java index 63a5f10d97..6f43203fe4 100644 --- a/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/ProtoBlockFileReader.java +++ b/hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/reader/block/ProtoBlockFileReader.java @@ -242,7 +242,9 @@ public BlockItem readBlockItemFor(ItemCase itemCase) { case EVENT_HEADER, EVENT_TRANSACTION -> blockRootHashDigest.addInputBlockItem(blockItem); case STATE_CHANGES, TRANSACTION_OUTPUT, TRANSACTION_RESULT -> blockRootHashDigest.addOutputBlockItem( blockItem); - default -> {} + default -> { + // other block items aren't considered input / output + } } return blockItem;