@Test
public void duplicates() throws Exception {

    // Adding a block twice should not have any effect, in particular it should not send the block to the wallet.
    Block b1 = unitTestParams.getGenesisBlock().createNextBlock(coinbaseTo);
    Block b2 = b1.createNextBlock(coinbaseTo);
    Block b3 = b2.createNextBlock(coinbaseTo);
    assertTrue(chain.add(b1));
    assertEquals(b1, block[0].getHeader());
    assertTrue(chain.add(b2));
    assertEquals(b2, block[0].getHeader());
    assertTrue(chain.add(b3));
    assertEquals(b3, block[0].getHeader());
    assertEquals(b3, chain.getChainHead().getHeader());
    assertTrue(chain.add(b2));
    assertEquals(b3, chain.getChainHead().getHeader());
    // Wallet was NOT called with the new block because the duplicate add was spotted.
    assertEquals(b3, block[0].getHeader());
}