use of io.nuls.consensus.poc.storage.utils.PunishLogComparator in project nuls by nuls-io.
the class CacheLoader method loadYellowPunishList.
public List<PunishLogPo> loadYellowPunishList(List<PunishLogPo> allPunishList, int roundSize) {
List<PunishLogPo> list = new ArrayList<>();
BlockHeader blockHeader = blockService.getBestBlockHeader().getData();
if (null == blockHeader) {
return list;
}
BlockExtendsData roundData = new BlockExtendsData(blockHeader.getExtend());
long breakRoundIndex = roundData.getRoundIndex() - roundSize;
for (PunishLogPo po : allPunishList) {
if (po.getType() == PunishType.RED.getCode()) {
continue;
}
if (po.getRoundIndex() <= breakRoundIndex) {
continue;
}
list.add(po);
}
Collections.sort(list, new PunishLogComparator());
return list;
}
use of io.nuls.consensus.poc.storage.utils.PunishLogComparator in project nuls by nuls-io.
the class CacheLoader method loadRedPunishList.
public List<PunishLogPo> loadRedPunishList(List<PunishLogPo> allPunishList) {
List<PunishLogPo> list = new ArrayList<>();
for (PunishLogPo po : allPunishList) {
if (po.getType() == PunishType.RED.getCode()) {
list.add(po);
}
}
Collections.sort(list, new PunishLogComparator());
return list;
}
Aggregations