Skip to content

Commit

Permalink
Added logs
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Malygin <ivan@swirldslabs.com>
  • Loading branch information
imalygin committed Dec 2, 2024
1 parent 355d2bd commit 0e0215a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,8 @@ public void createSnapshot(@NonNull final Path targetPath) {
*/
@Override
public MerkleStateRoot<?> loadSnapshot(@NonNull Path targetPath) throws IOException {
return (MerkleStateRoot<?>) MerkleTreeSnapshotReader.readStateFileData(targetPath).stateRoot();
MerkleStateRoot<?> merkleStateRoot = (MerkleStateRoot<?>) MerkleTreeSnapshotReader.readStateFileData(targetPath).stateRoot();
logger.info(STARTUP.getMarker(), "Loaded root is immutable: {}", merkleStateRoot.isImmutable());
return merkleStateRoot;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
import com.swirlds.common.crypto.Hash;
import com.swirlds.common.io.streams.MerkleDataInputStream;
import com.swirlds.common.merkle.impl.PartialNaryMerkleInternal;
import com.swirlds.logging.legacy.LogMarker;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
Expand All @@ -34,6 +38,7 @@
*/
public class MerkleTreeSnapshotReader {

private static Logger log = LogManager.getLogger(MerkleTreeSnapshotReader.class);
/**
* The previous version of the signed state file
*/
Expand Down Expand Up @@ -102,6 +107,7 @@ private static StateFileData readStateFileDataV1(
throws IOException {
try {
final PartialNaryMerkleInternal state = in.readMerkleTree(directory, MAX_MERKLE_NODES_IN_STATE);
log.info(LogMarker.STARTUP.getMarker(), "State is immutable: {}", state.isImmutable());
final Hash hash = in.readSerializable();
final SigSet sigSet = in.readSerializable();
return new StateFileData(state, hash, sigSet);
Expand Down

0 comments on commit 0e0215a

Please sign in to comment.