Skip to content

Commit

Permalink
Added debug 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 3, 2024
1 parent 0e0215a commit 4c0f331
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,22 @@ public void handleConsensusRound(final Round round, final PlatformStateModifier
@Override
public MigrationTestingToolState copy() {
throwIfImmutable();
//setImmutable(true);
setImmutable(true);
logger.info("Copying state in " + getCallTrace());
return new MigrationTestingToolState(this);
}

public static String getCallTrace() {
StringBuilder callTrace = new StringBuilder();
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

for (StackTraceElement element : stackTrace) {
callTrace.append(element.toString()).append("\n");
}

return callTrace.toString();
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.swirlds.common.config.StateCommonConfig;
import com.swirlds.common.crypto.Hash;
import com.swirlds.common.io.utility.RecycleBin;
import com.swirlds.common.merkle.MerkleNode;
import com.swirlds.common.merkle.crypto.MerkleCryptoFactory;
import com.swirlds.common.platform.NodeId;
import com.swirlds.config.api.Configuration;
Expand All @@ -40,6 +41,7 @@
import com.swirlds.platform.state.snapshot.SignedStateFilePath;
import com.swirlds.platform.system.SoftwareVersion;
import com.swirlds.platform.system.address.AddressBook;
import com.swirlds.state.merkle.MerkleStateRoot;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.IOException;
Expand Down Expand Up @@ -96,6 +98,9 @@ public static HashedReservedSignedState getInitialState(

try (loadedState) {
if (loadedState.isNotNull()) {
MerkleNode state = loadedState.get().getState();
state.treeIterator().forEachRemaining(node -> logger.info(STARTUP.getMarker(), "Node type: {}, isImmutable {}", node.getClass().getSimpleName(),
node.isImmutable()));
logger.info(
STARTUP.getMarker(),
new SavedStateLoadedPayload(
Expand Down

0 comments on commit 4c0f331

Please sign in to comment.