Merge pull request #86 from nicksavers/master
Pretty print for JSON dump and cleanup gitignore
This commit is contained in:
commit
887c1dcbdd
|
@ -1,31 +1,32 @@
|
|||
|
||||
.idea
|
||||
*.iml
|
||||
# Java
|
||||
*.class
|
||||
|
||||
*.xlsx
|
||||
# Intellij
|
||||
.idea/
|
||||
*.iml
|
||||
*.iws
|
||||
|
||||
# Eclipse
|
||||
.project
|
||||
.classpath
|
||||
.settings
|
||||
.settings/
|
||||
/bin
|
||||
|
||||
# Maven
|
||||
log/
|
||||
target/
|
||||
|
||||
# Package Files #
|
||||
*.zip
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
/target
|
||||
/src/main/java/samples
|
||||
|
||||
# Output #
|
||||
/blockchain
|
||||
/state
|
||||
/details
|
||||
/logs
|
||||
/dmp
|
||||
/database
|
||||
*.db
|
||||
*.xlsx
|
||||
/gen
|
||||
/null
|
||||
|
||||
# Mac
|
||||
.DS_Store
|
|
@ -18,6 +18,8 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
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.ObjectNode;
|
||||
|
||||
|
@ -407,12 +409,9 @@ public class Repository {
|
|||
ObjectNode blockNode = jsonFactory.objectNode();
|
||||
JSONHelper.dumpBlock(blockNode, block, gasUsed, this.getWorldState().getRootHash(), keys, this);
|
||||
|
||||
bw.write(blockNode.toString());
|
||||
bw.write("\n");
|
||||
|
||||
String rootHash = Hex.toHexString(this.getWorldState().getRootHash());
|
||||
bw.write(String.format(" => Global State Root: [ %s ]", rootHash)
|
||||
);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
||||
bw.write(mapper.writeValueAsString(blockNode));
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
|
|
Loading…
Reference in New Issue