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)
| 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. |
no test coverage detected