Search in sources :

Example 1 with Sibling

use of co.rsk.remasc.Sibling in project rskj by rsksmart.

the class SelectionRule method isBrokenSelectionRule.

public static boolean isBrokenSelectionRule(BlockHeader processingBlockHeader, List<Sibling> siblings) {
    int maxUncleCount = 0;
    for (Sibling sibling : siblings) {
        maxUncleCount = Math.max(maxUncleCount, sibling.getUncleCount());
        Coin pfm = processingBlockHeader.getPaidFees().multiply(PAID_FEES_MULTIPLIER_CRITERIA);
        if (sibling.getPaidFees().compareTo(pfm) > 0) {
            return true;
        }
        Coin blockFeesCriteria = sibling.getPaidFees().multiply(PAID_FEES_MULTIPLIER_CRITERIA);
        if (processingBlockHeader.getPaidFees().compareTo(blockFeesCriteria) < 0 && isThisBlockHashSmaller(sibling.getHash(), processingBlockHeader.getHash().getBytes())) {
            return true;
        }
    }
    return maxUncleCount > processingBlockHeader.getUncleCount();
}
Also used : Coin(co.rsk.core.Coin) Sibling(co.rsk.remasc.Sibling)

Aggregations

Coin (co.rsk.core.Coin)1 Sibling (co.rsk.remasc.Sibling)1