MCPcopy Create free account
hub / github.com/dsg-titech/simblock / printAddBlock

Method printAddBlock

simulator/src/main/java/simblock/node/Node.java:304–314  ·  view source on GitHub ↗

Logs the provided block to the logfile. @param newBlock the block to be logged

(Block newBlock)

Source from the content-addressed store, hash-verified

302 * @param newBlock the block to be logged
303 */
304 private void printAddBlock(Block newBlock) {
305 OUT_JSON_FILE.print("{");
306 OUT_JSON_FILE.print("\"kind\":\"add-block\",");
307 OUT_JSON_FILE.print("\"content\":{");
308 OUT_JSON_FILE.print("\"timestamp\":" + getCurrentTime() + ",");
309 OUT_JSON_FILE.print("\"node-id\":" + this.getNodeID() + ",");
310 OUT_JSON_FILE.print("\"block-id\":" + newBlock.getId());
311 OUT_JSON_FILE.print("}");
312 OUT_JSON_FILE.print("},");
313 OUT_JSON_FILE.flush();
314 }
315
316 /**
317 * Add orphans.

Callers 1

addToChainMethod · 0.95

Calls 3

getNodeIDMethod · 0.95
getCurrentTimeMethod · 0.80
getIdMethod · 0.80

Tested by

no test coverage detected