@Test public void startMiningConsumer() throws Exception { SysPropConfig2.props.overrideParams(ConfigFactory.parseString( "peer.listen.port = 30336 \n" + "peer.privateKey = 3ec771c31cac8c0dba77a69e503765701d3c2bb62435888d4ffa38fed60c445c \n" + "peer.networkId = 555 \n" + "peer.active = [" + "{ url = \"enode: "{ url = \"enode: "] \n" + "sync.enabled = true \n" + "genesis = genesis-harder.json \n" + "database.dir = testDB-1 \n")); Ethereum ethereum2 = EthereumFactory.createEthereum(SysPropConfig2.props, SysPropConfig2.class); final CountDownLatch semaphore = new CountDownLatch(1); ethereum2.addListener(new EthereumListenerAdapter() { @Override public void onBlock(Block block, List<TransactionReceipt> receipts) { System.err.println("=== New block: " + blockInfo(block)); System.err.println(block); for (Transaction tx : block.getTransactionsList()) { } } @Override public void onPendingTransactionsReceived(List<Transaction> transactions) { System.err.println("=== Tx: " + transactions); } @Override public void onSyncDone(SyncState state) { semaphore.countDown(); System.err.println("=== Sync Done!"); } }); System.out.println("Waiting for sync..."); semaphore.await(); ECKey senderKey = ECKey.fromPrivate(Hex.decode("6ef8da380c27cea8fdf7448340ea99e8e2268fc2950d79ed47cbf6f85dc977ec")); byte[] receiverAddr = Hex.decode("5db10750e8caff27f906b41c71b3471057dd2004"); for (int i = ethereum2.getRepository().getNonce(senderKey.getAddress()).intValue(), j = 0; j < 200; i++, j++) { { Transaction tx = new Transaction(ByteUtil.intToBytesNoLeadZeroes(i), ByteUtil.longToBytesNoLeadZeroes(50_000_000_000L), ByteUtil.longToBytesNoLeadZeroes(0xfffff), receiverAddr, new byte[]{77}, new byte[0]); tx.sign(senderKey); System.out.println("=== Submitting tx: " + tx); ethereum2.submitTransaction(tx); submittedTxs.put(new ByteArrayWrapper(tx.getHash()), Pair.of(tx, System.currentTimeMillis())); } Thread.sleep(7000); } Thread.sleep(100000000L); }
private void sleep() { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } }
Miner { private void sleep() { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } }
Miner { private void sleep() { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } }  }
Miner { private void sleep() { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } }  boolean mine(Block newBlock, byte[] difficulty); void stop(); }
Miner { private void sleep() { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } }  boolean mine(Block newBlock, byte[] difficulty); void stop();  }