Skip to content

Commit

Permalink
code smells again
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Li <[email protected]>
  • Loading branch information
xin-hedera committed Jan 9, 2025
1 parent b47c4f0 commit f6940e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<byte[]> leaves = new ArrayList<>();
leaves.add(previousHash);
Expand All @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f6940e5

Please sign in to comment.