Pretty-print block state dump
This commit is contained in:
parent
28c514559d
commit
7abda07a53
|
@ -18,6 +18,8 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.spongycastle.util.encoders.Hex;
|
import org.spongycastle.util.encoders.Hex;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
||||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
|
|
||||||
|
@ -407,12 +409,9 @@ public class Repository {
|
||||||
ObjectNode blockNode = jsonFactory.objectNode();
|
ObjectNode blockNode = jsonFactory.objectNode();
|
||||||
JSONHelper.dumpBlock(blockNode, block, gasUsed, this.getWorldState().getRootHash(), keys, this);
|
JSONHelper.dumpBlock(blockNode, block, gasUsed, this.getWorldState().getRootHash(), keys, this);
|
||||||
|
|
||||||
bw.write(blockNode.toString());
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
bw.write("\n");
|
mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||||
|
bw.write(mapper.writeValueAsString(blockNode));
|
||||||
String rootHash = Hex.toHexString(this.getWorldState().getRootHash());
|
|
||||||
bw.write(String.format(" => Global State Root: [ %s ]", rootHash)
|
|
||||||
);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error(e.getMessage(), e);
|
logger.error(e.getMessage(), e);
|
||||||
|
|
Loading…
Reference in New Issue