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

Method addToChain

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

Adds a new block to the to chain. If node was minting that task instance is abandoned, and the new block arrival is handled. @param newBlock the new block

(Block newBlock)

Source from the content-addressed store, hash-verified

284 * @param newBlock the new block
285 */
286 public void addToChain(Block newBlock) {
287 // If the node has been minting
288 if (this.mintingTask != null) {
289 removeTask(this.mintingTask);
290 this.mintingTask = null;
291 }
292 // Update the current block
293 this.block = newBlock;
294 printAddBlock(newBlock);
295 // Observe and handle new block arrival
296 arriveBlock(newBlock, this);
297 }
298
299 /**
300 * Logs the provided block to the logfile.

Callers 1

receiveBlockMethod · 0.95

Calls 3

printAddBlockMethod · 0.95
removeTaskMethod · 0.80
arriveBlockMethod · 0.80

Tested by

no test coverage detected