Skip to content

Commit b549a70

Browse files
authored
Invert validatorActiveLongEnough check to be more clear (Consensys#8196)
1 parent 6a84100 commit b549a70

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ public void processExecutionLayerExits(
158158
final Validator validator = state.getValidators().get(validatorIndex);
159159

160160
// Check if validator has eth1 credentials
161-
boolean isExecutionAddress = predicates.hasEth1WithdrawalCredential(validator);
161+
final boolean isExecutionAddress = predicates.hasEth1WithdrawalCredential(validator);
162162
if (!isExecutionAddress) {
163163
return;
164164
}
165165

166166
// Check exit source_address matches validator eth1 withdrawal credentials
167167
final Bytes20 executionAddress =
168168
new Bytes20(validator.getWithdrawalCredentials().slice(12));
169-
boolean isCorrectSourceAddress = executionAddress.equals(exit.getSourceAddress());
169+
final boolean isCorrectSourceAddress = executionAddress.equals(exit.getSourceAddress());
170170
if (!isCorrectSourceAddress) {
171171
return;
172172
}
@@ -178,16 +178,16 @@ public void processExecutionLayerExits(
178178
}
179179

180180
// Check if validator has already initiated exit
181-
boolean hasInitiatedExit = !validator.getExitEpoch().equals(FAR_FUTURE_EPOCH);
181+
final boolean hasInitiatedExit = !validator.getExitEpoch().equals(FAR_FUTURE_EPOCH);
182182
if (hasInitiatedExit) {
183183
return;
184184
}
185185

186186
// Check if validator has been active long enough
187187
final boolean validatorActiveLongEnough =
188-
currentEpoch.isLessThan(
188+
currentEpoch.isGreaterThanOrEqualTo(
189189
validator.getActivationEpoch().plus(specConfig.getShardCommitteePeriod()));
190-
if (validatorActiveLongEnough) {
190+
if (!validatorActiveLongEnough) {
191191
return;
192192
}
193193

0 commit comments

Comments
 (0)