diff --git a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java index 3469465466..34e4216797 100644 --- a/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java +++ b/rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java @@ -1029,7 +1029,7 @@ private void updateSvpState(Transaction rskTx) { // if the proposed federation exists and the validation period ended, // we can conclude that the svp failed Federation proposedFederation = proposedFederationOpt.get(); - if (!validationPeriodIsOngoing(proposedFederation)) { + if (!isSvpOngoing()) { processSvpFailure(proposedFederation); return; } @@ -1079,16 +1079,12 @@ private void allowFederationElectionAgain() { } private boolean isSvpOngoing() { - return federationSupport.getProposedFederation() - .filter(this::validationPeriodIsOngoing) - .isPresent(); - } - - private boolean validationPeriodIsOngoing(Federation proposedFederation) { - long validationPeriodEndBlock = proposedFederation.getCreationBlockNumber() + - bridgeConstants.getFederationConstants().getValidationPeriodDurationInBlocks(); - - return rskExecutionBlock.getNumber() < validationPeriodEndBlock; + return federationSupport + .getProposedFederation() + .map(proposedFederation -> rskExecutionBlock.getNumber() < proposedFederation.getCreationBlockNumber() + + bridgeConstants.getFederationConstants().getValidationPeriodDurationInBlocks() + ) + .orElse(false); } private void processSvpFundTransactionUnsigned(Keccak256 rskTxHash, Federation proposedFederation) {