Source:
private void produceQueue() { while (!Thread.currentThread().isInterrupted()) { BlockWrapper wrapper = null; try { wrapper = blockQueue.take(); logger.debug("BlockQueue size: {}, headers queue size: {}", blockQueue.size(), syncQueue.getHeadersCount()); ImportResult importResult = blockchain.tryToConnect(wrapper.getBlock()); if (importResult == IMPORTED_BEST) { logger.info("Success importing BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (wrapper.isNewBlock() && !syncDone) { syncDone = true; channelManager.onSyncDone(true); compositeEthereumListener.onSyncDone(); } } if (importResult == IMPORTED_NOT_BEST) logger.info("Success importing NOT_BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (syncDone && (importResult == IMPORTED_BEST || importResult == IMPORTED_NOT_BEST)) { if (logger.isDebugEnabled()) logger.debug("Block dump: " + Hex.toHexString(wrapper.getBlock().getEncoded())); if (wrapper.isNewBlock()) { Channel receivedFrom = channelManager.getActivePeer(wrapper.getNodeId()); channelManager.sendNewBlock(wrapper.getBlock(), receivedFrom); } } if (importResult == NO_PARENT) { logger.error("No parent on the chain for block.number: block.hash: {}", wrapper.getNumber(), wrapper.getBlock().getShortHash()); } } catch (InterruptedException e) { break; } catch (Throwable e) { logger.error("Error processing block {}: ", wrapper.getBlock().getShortDescr(), e); logger.error("Block dump: {}", Hex.toHexString(wrapper.getBlock().getEncoded())); } } }

Target:
private void produceQueue() { while (!Thread.currentThread().isInterrupted()) { BlockWrapper wrapper = null; try { wrapper = blockQueue.take(); logger.debug("BlockQueue size: {}, headers queue size: {}", blockQueue.size(), syncQueue.getHeadersCount()); ImportResult importResult = blockchain.tryToConnect(wrapper.getBlock()); if (importResult == IMPORTED_BEST) { logger.info("Success importing BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (wrapper.isNewBlock() && !syncDone) { syncDone = true; channelManager.onSyncDone(true); compositeEthereumListener.onSyncDone(); } } if (importResult == IMPORTED_NOT_BEST) logger.info("Success importing NOT_BEST: block.number: {}, block.hash: {}, tx.size: ", wrapper.getNumber(), wrapper.getBlock().getShortHash(), wrapper.getBlock().getTransactionsList().size()); if (syncDone && (importResult == IMPORTED_BEST || importResult == IMPORTED_NOT_BEST)) { if (logger.isDebugEnabled()) logger.debug("Block dump: " + Hex.toHexString(wrapper.getBlock().getEncoded())); if (wrapper.isNewBlock()) newBlocks.add(wrapper); } if (importResult == NO_PARENT) { logger.error("No parent on the chain for block.number: block.hash: {}", wrapper.getNumber(), wrapper.getBlock().getShortHash()); } } catch (InterruptedException e) { break; } catch (Throwable e) { if (wrapper != null) { logger.error("Error processing block {}: ", wrapper.getBlock().getShortDescr(), e); logger.error("Block dump: {}", Hex.toHexString(wrapper.getBlock().getEncoded())); } else { logger.error("Error processing unknown block", e); } } } }