Program: 85707
Project: 85707
Buggy source:
/** 
 * Creates the initial multisig contract and incomplete refund transaction which can be requested at the appropriate time using   {@link PaymentChannelClientState#getIncompleteRefundTransaction} and{@link PaymentChannelClientState#getMultisigContract()}. The way the contract is crafted can be adjusted by overriding   {@link PaymentChannelClientState#editContractSendRequest(com.google.bitcoin.core.Wallet.SendRequest)}. By default unconfirmed coins are allowed to be used, as for micropayments the risk should be relatively low.
 * @throws ValueOutOfRangeException if the value being used is too small to be accepted by the network
 * @throws InsufficientMoneyException if the wallet doesn't contain enough balance to initiate
 */
public synchronized void initiate() throws ValueOutOfRangeException, InsufficientMoneyException {
  final NetworkParameters params=wallet.getParams();
  Transaction template=new Transaction(params);
  List<ECKey> keys=Lists.newArrayList(myKey,serverMultisigKey);
  TransactionOutput multisigOutput=template.addOutput(totalValue,ScriptBuilder.createMultiSigOutputScript(2,keys));
  if (multisigOutput.getMinNonDustValue().compareTo(totalValue) > 0)   throw new ValueOutOfRangeException("String_Node_Str");
  Wallet.SendRequest req=Wallet.SendRequest.forTx(template);
  req.coinSelector=AllowUnconfirmedCoinSelector.get();
  editContractSendRequest(req);
  req.shuffleOutputs=false;
  wallet.completeTx(req);
  Coin multisigFee=req.fee;
  multisigContract=req.tx;
  refundTx=new Transaction(params);
  refundTx.addInput(multisigOutput).setSequenceNumber(0);
  refundTx.setLockTime(expiryTime);
  if (totalValue.compareTo(Coin.CENT) < 0) {
    final Coin valueAfterFee=totalValue.subtract(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE);
    if (Transaction.MIN_NONDUST_OUTPUT.compareTo(valueAfterFee) > 0)     throw new ValueOutOfRangeException("String_Node_Str");
    refundTx.addOutput(valueAfterFee,myKey.toAddress(params));
    refundFees=multisigFee.add(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE);
  }
 else {
    refundTx.addOutput(totalValue,myKey.toAddress(params));
    refundFees=multisigFee;
  }
  refundTx.getConfidence().setSource(TransactionConfidence.Source.SELF);
  log.info("String_Node_Str",multisigContract.getHashAsString(),refundTx.getHashAsString());
  state=State.INITIATED;
}

Fixed version (ground truth):
/** 
 * Creates the initial multisig contract and incomplete refund transaction which can be requested at the appropriate time using   {@link PaymentChannelClientState#getIncompleteRefundTransaction} and{@link PaymentChannelClientState#getMultisigContract()}. The way the contract is crafted can be adjusted by overriding   {@link PaymentChannelClientState#editContractSendRequest(com.google.bitcoin.core.Wallet.SendRequest)}. By default unconfirmed coins are allowed to be used, as for micropayments the risk should be relatively low.
 * @throws ValueOutOfRangeException if the value being used is too small to be accepted by the network
 * @throws InsufficientMoneyException if the wallet doesn't contain enough balance to initiate
 */
public synchronized void initiate() throws ValueOutOfRangeException, InsufficientMoneyException {
  final NetworkParameters params=wallet.getParams();
  Transaction template=new Transaction(params);
  List<ECKey> keys=Lists.newArrayList(myKey,serverMultisigKey);
  TransactionOutput multisigOutput=template.addOutput(totalValue,ScriptBuilder.createMultiSigOutputScript(2,keys));
  if (multisigOutput.getMinNonDustValue().compareTo(totalValue) > 0)   throw new ValueOutOfRangeException("String_Node_Str");
  Wallet.SendRequest req=Wallet.SendRequest.forTx(template);
  req.coinSelector=AllowUnconfirmedCoinSelector.get();
  editContractSendRequest(req);
  req.shuffleOutputs=false;
  wallet.completeTx(req);
  Coin multisigFee=req.tx.getFee();
  multisigContract=req.tx;
  refundTx=new Transaction(params);
  refundTx.addInput(multisigOutput).setSequenceNumber(0);
  refundTx.setLockTime(expiryTime);
  if (totalValue.compareTo(Coin.CENT) < 0) {
    final Coin valueAfterFee=totalValue.subtract(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE);
    if (Transaction.MIN_NONDUST_OUTPUT.compareTo(valueAfterFee) > 0)     throw new ValueOutOfRangeException("String_Node_Str");
    refundTx.addOutput(valueAfterFee,myKey.toAddress(params));
    refundFees=multisigFee.add(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE);
  }
 else {
    refundTx.addOutput(totalValue,myKey.toAddress(params));
    refundFees=multisigFee;
  }
  refundTx.getConfidence().setSource(TransactionConfidence.Source.SELF);
  log.info("String_Node_Str",multisigContract.getHashAsString(),refundTx.getHashAsString());
  state=State.INITIATED;
}