Program: 35118
Project: 35118
Buggy source:
public boolean rollback(){
  List<Block> blockList=chain.getBlockList();
  if (blockList == null || blockList.size() == 0) {
    return false;
  }
  Block rollbackBlock=blockList.get(blockList.size() - 1);
  blockList.remove(rollbackBlock);
  List<BlockHeader> blockHeaderList=chain.getBlockHeaderList();
  if (blockHeaderList.size() == 1) {
    Log.error("String_Node_Str");
  }
  chain.setEndBlockHeader(blockHeaderList.get(blockHeaderList.size() - 2));
  BlockHeader rollbackBlockHeader=blockHeaderList.get(blockHeaderList.size() - 1);
  blockHeaderList.remove(rollbackBlockHeader);
  List<Consensus<Agent>> agentList=chain.getAgentList();
  List<Consensus<Deposit>> depositList=chain.getDepositList();
  List<PunishLogPo> yellowList=chain.getYellowPunishList();
  List<PunishLogPo> redPunishList=chain.getRedPunishList();
  long height=rollbackBlockHeader.getHeight();
  for (int i=agentList.size() - 1; i >= 0; i--) {
    Consensus<Agent> agentConsensus=agentList.get(i);
    Agent agent=agentConsensus.getExtend();
    if (agentConsensus.getDelHeight() == height) {
      agentConsensus.setDelHeight(0);
    }
    if (agent.getBlockHeight() == height) {
      depositList.remove(i);
    }
  }
  for (int i=depositList.size() - 1; i >= 0; i--) {
    Consensus<Deposit> tempDe=depositList.get(i);
    Deposit deposit=tempDe.getExtend();
    if (tempDe.getDelHeight() == height) {
      tempDe.setDelHeight(0);
    }
    if (deposit.getBlockHeight() == height) {
      depositList.remove(i);
    }
  }
  for (int i=yellowList.size() - 1; i >= 0; i--) {
    PunishLogPo tempYellow=yellowList.get(i);
    if (tempYellow.getHeight() < height) {
      break;
    }
    if (tempYellow.getHeight() == height) {
      yellowList.remove(i);
    }
  }
  for (int i=redPunishList.size() - 1; i >= 0; i--) {
    PunishLogPo redPunish=redPunishList.get(i);
    if (redPunish.getHeight() < height) {
      break;
    }
    if (redPunish.getHeight() == height) {
      redPunishList.remove(i);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean rollback(){
  List<Block> blockList=chain.getBlockList();
  if (blockList == null || blockList.size() == 0) {
    return false;
  }
  Block rollbackBlock=blockList.get(blockList.size() - 1);
  blockList.remove(rollbackBlock);
  List<BlockHeader> blockHeaderList=chain.getBlockHeaderList();
  if (blockHeaderList.size() == 1) {
    Log.error("String_Node_Str");
  }
  chain.setEndBlockHeader(blockHeaderList.get(blockHeaderList.size() - 2));
  BlockHeader rollbackBlockHeader=blockHeaderList.get(blockHeaderList.size() - 1);
  blockHeaderList.remove(rollbackBlockHeader);
  List<Consensus<Agent>> agentList=chain.getAgentList();
  List<Consensus<Deposit>> depositList=chain.getDepositList();
  List<PunishLogPo> yellowList=chain.getYellowPunishList();
  List<PunishLogPo> redPunishList=chain.getRedPunishList();
  long height=rollbackBlockHeader.getHeight();
  for (int i=agentList.size() - 1; i >= 0; i--) {
    Consensus<Agent> agentConsensus=agentList.get(i);
    Agent agent=agentConsensus.getExtend();
    if (agentConsensus.getDelHeight() == height) {
      agentConsensus.setDelHeight(0);
    }
    if (agent.getBlockHeight() == height) {
      agentList.remove(i);
    }
  }
  for (int i=depositList.size() - 1; i >= 0; i--) {
    Consensus<Deposit> tempDe=depositList.get(i);
    Deposit deposit=tempDe.getExtend();
    if (tempDe.getDelHeight() == height) {
      tempDe.setDelHeight(0);
    }
    if (deposit.getBlockHeight() == height) {
      depositList.remove(i);
    }
  }
  for (int i=yellowList.size() - 1; i >= 0; i--) {
    PunishLogPo tempYellow=yellowList.get(i);
    if (tempYellow.getHeight() < height) {
      break;
    }
    if (tempYellow.getHeight() == height) {
      yellowList.remove(i);
    }
  }
  for (int i=redPunishList.size() - 1; i >= 0; i--) {
    PunishLogPo redPunish=redPunishList.get(i);
    if (redPunish.getHeight() < height) {
      break;
    }
    if (redPunish.getHeight() == height) {
      redPunishList.remove(i);
    }
  }
  return true;
}