Program: 85718
Project: 85718
Buggy source:
/** 
 * Called by the   {@link BlockChain} when we receive a new filtered block that contains a transactions previouslyreceived by a call to @{link receivePending}.<p> This is necessary for the internal book-keeping Wallet does. When a transaction is received that sends us coins it is added to a pool so we can use it later to create spends. When a transaction is received that consumes outputs they are marked as spent so they won't be used in future.<p> A transaction that spends our own coins can be received either because a spend we created was accepted by the network and thus made it into a block, or because our keys are being shared between multiple instances and some other node spent the coins instead. We still have to know about that to avoid accidentally trying to double spend.<p> A transaction may be received multiple times if is included into blocks in parallel chains. The blockType parameter describes whether the containing block is on the main/best chain or whether it's on a presently inactive side chain. We must still record these transactions and the blocks they appear in because a future block might change which chain is best causing a reorganize. A re-org can totally change our balance!
 */
public void notifyTransactionIsInBlock(Sha256Hash txHash,StoredBlock block,BlockChain.NewBlockType blockType,int relativityOffset) throws VerificationException {
  lock.lock();
  try {
    Transaction tx=transactions.get(txHash);
    if (tx == null) {
      tx=riskDropped.get(txHash);
      if (tx != null) {
        log.info("String_Node_Str",tx.getHash());
      }
 else {
        log.error("String_Node_Str",txHash);
        return;
      }
    }
    receive(tx,block,blockType,relativityOffset);
  }
  finally {
    lock.unlock();
  }
  if (blockType == AbstractBlockChain.NewBlockType.BEST_CHAIN) {
    maybeRotateKeys();
  }
}

Fixed version (ground truth):
/** 
 * Called by the   {@link BlockChain} when we receive a new filtered block that contains a transactions previouslyreceived by a call to @{link receivePending}.<p> This is necessary for the internal book-keeping Wallet does. When a transaction is received that sends us coins it is added to a pool so we can use it later to create spends. When a transaction is received that consumes outputs they are marked as spent so they won't be used in future.<p> A transaction that spends our own coins can be received either because a spend we created was accepted by the network and thus made it into a block, or because our keys are being shared between multiple instances and some other node spent the coins instead. We still have to know about that to avoid accidentally trying to double spend.<p> A transaction may be received multiple times if is included into blocks in parallel chains. The blockType parameter describes whether the containing block is on the main/best chain or whether it's on a presently inactive side chain. We must still record these transactions and the blocks they appear in because a future block might change which chain is best causing a reorganize. A re-org can totally change our balance!
 */
public boolean notifyTransactionIsInBlock(Sha256Hash txHash,StoredBlock block,BlockChain.NewBlockType blockType,int relativityOffset) throws VerificationException {
  lock.lock();
  try {
    Transaction tx=transactions.get(txHash);
    if (tx == null) {
      tx=riskDropped.get(txHash);
      if (tx != null) {
        log.info("String_Node_Str",tx.getHash());
      }
 else {
        return false;
      }
    }
    receive(tx,block,blockType,relativityOffset);
  }
  finally {
    lock.unlock();
  }
  if (blockType == AbstractBlockChain.NewBlockType.BEST_CHAIN) {
    maybeRotateKeys();
  }
  return true;
}