Program: 31019
Project: 31019
Buggy source:
@Test public void projectAddedP2P() throws Exception {
  ObservableList<Project> projects=backend.mirrorProjects(gate);
  Path dropDir=Files.createTempDirectory("String_Node_Str");
  Path downloadedFile=writeProjectToDisk(dropDir);
  backend.importProjectFrom(downloadedFile);
  gate.waitAndRun();
  assertEquals(1,projects.size());
  Triplet<Transaction,Transaction,LHProtos.Pledge> data=TestUtils.makePledge(project,to,project.getGoalAmount());
  Transaction stubTx=data.getValue0();
  Transaction pledgeTx=data.getValue1();
  LHProtos.Pledge pledge=data.getValue2();
  ObservableSet<LHProtos.Pledge> pledges=backend.mirrorOpenPledges(project,gate);
  try (OutputStream stream=Files.newOutputStream(dropDir.resolve("String_Node_Str" + DiskManager.PLEDGE_FILE_EXTENSION))){
    pledge.writeTo(stream);
  }
   InboundMessageQueuer p1=connectPeer(1);
  assertNull(outbound(p1));
  InboundMessageQueuer p2=connectPeer(2,supportingVer);
  GetUTXOsMessage getutxos=(GetUTXOsMessage)waitForOutbound(p2);
  assertNotNull(getutxos);
  assertEquals(pledgeTx.getInput(0).getOutpoint(),getutxos.getOutPoints().get(0));
  inbound(p2,new UTXOsMessage(params,ImmutableList.of(stubTx.getOutput(0)),new long[]{UTXOsMessage.MEMPOOL_HEIGHT},blockStore.getChainHead().getHeader().getHash(),blockStore.getChainHead().getHeight()));
  BloomFilter filter=(BloomFilter)waitForOutbound(p2);
  assertEquals(filter,waitForOutbound(p1));
  assertTrue(filter.contains(stubTx.getOutput(0).getOutPointFor().bitcoinSerialize()));
  assertFalse(filter.contains(pledgeTx.bitcoinSerialize()));
  assertFalse(filter.contains(pledgeTx.getHash().getBytes()));
  assertEquals(MemoryPoolMessage.class,waitForOutbound(p1).getClass());
  assertEquals(MemoryPoolMessage.class,waitForOutbound(p2).getClass());
  AtomicBoolean flag=new AtomicBoolean(false);
  pledges.addListener((SetChangeListener<LHProtos.Pledge>)c -> {
    flag.set(c.wasAdded());
  }
);
  gate.waitAndRun();
  assertTrue(flag.get());
  assertEquals(1,pledges.size());
  final LHProtos.Pledge pledge2=pledges.iterator().next();
  assertEquals(Coin.COIN.value / 2,pledge2.getTotalInputValue());
  Transaction revocation=new Transaction(params);
  revocation.addInput(stubTx.getOutput(0));
  revocation.addOutput(stubTx.getOutput(0).getValue(),new ECKey().toAddress(params));
  Block newBlock=FakeTxBuilder.makeSolvedTestBlock(blockChain.getChainHead().getHeader(),revocation);
  FilteredBlock filteredBlock=filter.applyAndUpdate(newBlock);
  inbound(p1,filteredBlock);
  for (  Transaction transaction : filteredBlock.getAssociatedTransactions().values()) {
    inbound(p1,transaction);
  }
  inbound(p1,new Ping(123));
  gate.waitAndRun();
  assertEquals(0,pledges.size());
}

Fixed version (ground truth):
@Test public void projectAddedP2P() throws Exception {
  ObservableList<Project> projects=backend.mirrorProjects(gate);
  Path dropDir=Files.createTempDirectory("String_Node_Str");
  Path downloadedFile=writeProjectToDisk(dropDir);
  backend.importProjectFrom(downloadedFile);
  gate.waitAndRun();
  assertEquals(1,projects.size());
  Triplet<Transaction,Transaction,LHProtos.Pledge> data=TestUtils.makePledge(project,to,project.getGoalAmount());
  Transaction stubTx=data.getValue0();
  Transaction pledgeTx=data.getValue1();
  LHProtos.Pledge pledge=data.getValue2();
  ObservableSet<LHProtos.Pledge> pledges=backend.mirrorOpenPledges(project,gate);
  writePledgeToDisk(dropDir,pledge);
  InboundMessageQueuer p1=connectPeer(1);
  assertNull(outbound(p1));
  InboundMessageQueuer p2=connectPeer(2,supportingVer);
  GetUTXOsMessage getutxos=(GetUTXOsMessage)waitForOutbound(p2);
  assertNotNull(getutxos);
  assertEquals(pledgeTx.getInput(0).getOutpoint(),getutxos.getOutPoints().get(0));
  inbound(p2,new UTXOsMessage(params,ImmutableList.of(stubTx.getOutput(0)),new long[]{UTXOsMessage.MEMPOOL_HEIGHT},blockStore.getChainHead().getHeader().getHash(),blockStore.getChainHead().getHeight()));
  BloomFilter filter=(BloomFilter)waitForOutbound(p2);
  assertEquals(filter,waitForOutbound(p1));
  assertTrue(filter.contains(stubTx.getOutput(0).getOutPointFor().bitcoinSerialize()));
  assertFalse(filter.contains(pledgeTx.bitcoinSerialize()));
  assertFalse(filter.contains(pledgeTx.getHash().getBytes()));
  assertEquals(MemoryPoolMessage.class,waitForOutbound(p1).getClass());
  assertEquals(MemoryPoolMessage.class,waitForOutbound(p2).getClass());
  AtomicBoolean flag=new AtomicBoolean(false);
  pledges.addListener((SetChangeListener<LHProtos.Pledge>)c -> {
    flag.set(c.wasAdded());
  }
);
  gate.waitAndRun();
  assertTrue(flag.get());
  assertEquals(1,pledges.size());
  final LHProtos.Pledge pledge2=pledges.iterator().next();
  assertEquals(Coin.COIN.value / 2,pledge2.getTotalInputValue());
  Transaction revocation=new Transaction(params);
  revocation.addInput(stubTx.getOutput(0));
  revocation.addOutput(stubTx.getOutput(0).getValue(),new ECKey().toAddress(params));
  Block newBlock=FakeTxBuilder.makeSolvedTestBlock(blockChain.getChainHead().getHeader(),revocation);
  FilteredBlock filteredBlock=filter.applyAndUpdate(newBlock);
  inbound(p1,filteredBlock);
  for (  Transaction transaction : filteredBlock.getAssociatedTransactions().values()) {
    inbound(p1,transaction);
  }
  inbound(p1,new Ping(123));
  gate.waitAndRun();
  assertEquals(0,pledges.size());
}