Program: 85921
Project: 85921
Buggy source:
@Test public void fastCatchup() throws Exception {
  control.replay();
  connect();
  Block b1=createFakeBlock(unitTestParams,blockStore).block;
  blockChain.add(b1);
  Utils.rollMockClock(60 * 10);
  Block b2=makeSolvedTestBlock(unitTestParams,b1);
  Utils.rollMockClock(60 * 10);
  Block b3=makeSolvedTestBlock(unitTestParams,b2);
  Utils.rollMockClock(60 * 10);
  Block b4=makeSolvedTestBlock(unitTestParams,b3);
  peer.setFastCatchupTime((Utils.now().getTime() / 1000) - (600 * 2) + 1);
  peer.startBlockChainDownload();
  GetHeadersMessage getheaders=(GetHeadersMessage)event.getValue().getMessage();
  List<Sha256Hash> expectedLocator=new ArrayList<Sha256Hash>();
  expectedLocator.add(b1.getHash());
  expectedLocator.add(unitTestParams.genesisBlock.getHash());
  assertEquals(getheaders.getLocator(),expectedLocator);
  assertEquals(getheaders.getStopHash(),Sha256Hash.ZERO_HASH);
  HeadersMessage headers=new HeadersMessage(unitTestParams,b2.cloneAsHeader(),b3.cloneAsHeader(),b4.cloneAsHeader());
  expectedLocator.clear();
  expectedLocator.add(b2.getHash());
  expectedLocator.add(b1.getHash());
  expectedLocator.add(unitTestParams.genesisBlock.getHash());
  inbound(peer,headers);
  GetBlocksMessage getblocks=(GetBlocksMessage)event.getValue().getMessage();
  assertEquals(expectedLocator,getblocks.getLocator());
  assertEquals(b3.getHash(),getblocks.getStopHash());
  InventoryMessage inv=new InventoryMessage(unitTestParams);
  inv.addItem(new InventoryItem(InventoryItem.Type.Block,b3.getHash()));
  inbound(peer,inv);
  GetDataMessage getdata=(GetDataMessage)event.getValue().getMessage();
  assertEquals(b3.getHash(),getdata.getItems().get(0).hash);
  inbound(peer,b3);
}

Fixed version (ground truth):
@Test public void fastCatchup() throws Exception {
  control.replay();
  connect();
  Block b1=createFakeBlock(unitTestParams,blockStore).block;
  blockChain.add(b1);
  Utils.rollMockClock(60 * 10);
  Block b2=makeSolvedTestBlock(unitTestParams,b1);
  Utils.rollMockClock(60 * 10);
  Block b3=makeSolvedTestBlock(unitTestParams,b2);
  Utils.rollMockClock(60 * 10);
  Block b4=makeSolvedTestBlock(unitTestParams,b3);
  peer.setFastCatchupTime((Utils.now().getTime() / 1000) - (600 * 2) + 1);
  peer.startBlockChainDownload();
  GetHeadersMessage getheaders=(GetHeadersMessage)event.getValue().getMessage();
  List<Sha256Hash> expectedLocator=new ArrayList<Sha256Hash>();
  expectedLocator.add(b1.getHash());
  expectedLocator.add(unitTestParams.genesisBlock.getHash());
  assertEquals(getheaders.getLocator(),expectedLocator);
  assertEquals(getheaders.getStopHash(),Sha256Hash.ZERO_HASH);
  HeadersMessage headers=new HeadersMessage(unitTestParams,b2.cloneAsHeader(),b3.cloneAsHeader(),b4.cloneAsHeader());
  expectedLocator.clear();
  expectedLocator.add(b2.getHash());
  expectedLocator.add(b1.getHash());
  expectedLocator.add(unitTestParams.genesisBlock.getHash());
  inbound(peer,headers);
  GetBlocksMessage getblocks=(GetBlocksMessage)event.getValue().getMessage();
  assertEquals(expectedLocator,getblocks.getLocator());
  assertEquals(Sha256Hash.ZERO_HASH,getblocks.getStopHash());
  InventoryMessage inv=new InventoryMessage(unitTestParams);
  inv.addItem(new InventoryItem(InventoryItem.Type.Block,b3.getHash()));
  inbound(peer,inv);
  GetDataMessage getdata=(GetDataMessage)event.getValue().getMessage();
  assertEquals(b3.getHash(),getdata.getItems().get(0).hash);
  inbound(peer,b3);
}