@Test
public void unconnectedBlocks() throws Exception {

    Block b1 = unitTestParams.getGenesisBlock().createNextBlock(coinbaseTo);
    Block b2 = b1.createNextBlock(coinbaseTo);
    Block b3 = b2.createNextBlock(coinbaseTo);
    // Connected.
    assertTrue(chain.add(b1));
    // Unconnected but stored. The head of the chain is still b1.
    assertFalse(chain.add(b3));
    assertEquals(chain.getChainHead().getHeader(), b1.cloneAsHeader());
    // Add in the middle block.
    assertTrue(chain.add(b2));
    assertEquals(chain.getChainHead().getHeader(), b3.cloneAsHeader());
}