Program: 85940
Project: 85940
Buggy source:
private synchronized void receive(Transaction tx,StoredBlock block,BlockChain.NewBlockType blockType,boolean reorg) throws VerificationException, ScriptException {
  BigInteger prevBalance=getBalance();
  Sha256Hash txHash=tx.getHash();
  boolean bestChain=blockType == BlockChain.NewBlockType.BEST_CHAIN;
  boolean sideChain=blockType == BlockChain.NewBlockType.SIDE_CHAIN;
  BigInteger valueSentFromMe=tx.getValueSentFromMe(this);
  BigInteger valueSentToMe=tx.getValueSentToMe(this);
  BigInteger valueDifference=valueSentToMe.subtract(valueSentFromMe);
  if (!reorg) {
    log.info("String_Node_Str",new Object[]{sideChain ? "String_Node_Str" : "String_Node_Str",bitcoinValueToFriendlyString(valueDifference),tx.getHashAsString()});
  }
  Transaction wtx;
  if ((wtx=pending.remove(txHash)) != null) {
    tx=wtx;
    log.info("String_Node_Str");
    if (bestChain) {
      if (valueSentToMe.equals(BigInteger.ZERO)) {
        log.info("String_Node_Str");
        boolean alreadyPresent=spent.put(tx.getHash(),tx) != null;
        checkState(!alreadyPresent,"String_Node_Str");
      }
 else {
        log.info("String_Node_Str");
        boolean alreadyPresent=unspent.put(tx.getHash(),tx) != null;
        checkState(!alreadyPresent,"String_Node_Str");
      }
    }
 else     if (sideChain) {
      log.info("String_Node_Str");
      boolean alreadyPresent=inactive.put(tx.getHash(),tx) != null;
      if (alreadyPresent)       log.info("String_Node_Str");
      pending.put(tx.getHash(),tx);
    }
  }
 else {
    if (sideChain) {
      log.info("String_Node_Str");
      inactive.put(tx.getHash(),tx);
    }
 else     if (bestChain) {
      processTxFromBestChain(tx);
    }
  }
  log.info("String_Node_Str" + bitcoinValueToFriendlyString(getBalance()));
  if (block != null) {
    tx.setBlockAppearance(block,bestChain);
  }
  boolean wasPending=wtx != null;
  if (!reorg && bestChain && !wasPending) {
    BigInteger newBalance=getBalance();
    int diff=valueDifference.compareTo(BigInteger.ZERO);
    if (diff > 0) {
      invokeOnCoinsReceived(tx,prevBalance,newBalance);
    }
 else     if (diff == 0) {
      invokeOnCoinsSent(tx,prevBalance,newBalance);
    }
 else {
      invokeOnCoinsSent(tx,prevBalance,newBalance);
    }
  }
  checkState(isConsistent());
}

Fixed version (ground truth):
private synchronized void receive(Transaction tx,StoredBlock block,BlockChain.NewBlockType blockType,boolean reorg) throws VerificationException, ScriptException {
  BigInteger prevBalance=getBalance();
  Sha256Hash txHash=tx.getHash();
  boolean bestChain=blockType == BlockChain.NewBlockType.BEST_CHAIN;
  boolean sideChain=blockType == BlockChain.NewBlockType.SIDE_CHAIN;
  BigInteger valueSentFromMe=tx.getValueSentFromMe(this);
  BigInteger valueSentToMe=tx.getValueSentToMe(this);
  BigInteger valueDifference=valueSentToMe.subtract(valueSentFromMe);
  if (!reorg) {
    log.info("String_Node_Str",new Object[]{sideChain ? "String_Node_Str" : "String_Node_Str",bitcoinValueToFriendlyString(valueDifference),tx.getHashAsString()});
  }
  Transaction wtx;
  if ((wtx=pending.remove(txHash)) != null) {
    tx=wtx;
    log.info("String_Node_Str");
    if (bestChain) {
      if (valueSentToMe.equals(BigInteger.ZERO)) {
        log.info("String_Node_Str");
        boolean alreadyPresent=spent.put(tx.getHash(),tx) != null;
        checkState(!alreadyPresent,"String_Node_Str");
      }
 else {
        log.info("String_Node_Str");
        boolean alreadyPresent=unspent.put(tx.getHash(),tx) != null;
        checkState(!alreadyPresent,"String_Node_Str");
      }
    }
 else     if (sideChain) {
      log.info("String_Node_Str");
      boolean alreadyPresent=inactive.put(tx.getHash(),tx) != null;
      if (alreadyPresent)       log.info("String_Node_Str");
      pending.put(tx.getHash(),tx);
    }
  }
 else {
    if (sideChain) {
      if (unspent.containsKey(tx.getHash()) || spent.containsKey(tx.getHash())) {
      }
 else {
        log.info("String_Node_Str");
        inactive.put(tx.getHash(),tx);
      }
    }
 else     if (bestChain) {
      processTxFromBestChain(tx);
    }
  }
  log.info("String_Node_Str" + bitcoinValueToFriendlyString(getBalance()));
  if (block != null) {
    tx.setBlockAppearance(block,bestChain);
  }
  boolean wasPending=wtx != null;
  if (!reorg && bestChain && !wasPending) {
    BigInteger newBalance=getBalance();
    int diff=valueDifference.compareTo(BigInteger.ZERO);
    if (diff > 0) {
      invokeOnCoinsReceived(tx,prevBalance,newBalance);
    }
 else     if (diff == 0) {
      invokeOnCoinsSent(tx,prevBalance,newBalance);
    }
 else {
      invokeOnCoinsSent(tx,prevBalance,newBalance);
    }
  }
  checkState(isConsistent());
}