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 @@
|
||||||
|
# Java
|
||||||
.idea
|
|
||||||
*.iml
|
|
||||||
*.class
|
*.class
|
||||||
|
|
||||||
*.xlsx
|
# Intellij
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
|
||||||
# Eclipse
|
# Eclipse
|
||||||
.project
|
.project
|
||||||
.classpath
|
.classpath
|
||||||
.settings
|
.settings/
|
||||||
/bin
|
/bin
|
||||||
|
|
||||||
|
# Maven
|
||||||
|
log/
|
||||||
|
target/
|
||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.zip
|
*.zip
|
||||||
*.jar
|
*.jar
|
||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
/target
|
|
||||||
/src/main/java/samples
|
|
||||||
|
|
||||||
# Output #
|
# Output #
|
||||||
/blockchain
|
|
||||||
/state
|
|
||||||
/details
|
|
||||||
/logs
|
/logs
|
||||||
/dmp
|
/dmp
|
||||||
/database
|
/database
|
||||||
*.db
|
/null
|
||||||
*.xlsx
|
|
||||||
/gen
|
# Mac
|
||||||
|
.DS_Store
|
|
@ -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