@@ -3,7 +3,7 @@ import {PendingDeposit} from "@lodestar/types/lib/electra/types.js";
3
3
import { addValidatorToRegistry , isValidDepositSignature } from "../block/processDeposit.js" ;
4
4
import { CachedBeaconStateElectra , EpochTransitionCache } from "../types.js" ;
5
5
import { increaseBalance } from "../util/balance.js" ;
6
- import { hasCompoundingWithdrawalCredential } from "../util/electra.js" ;
6
+ import { hasCompoundingWithdrawalCredential , isValidatorKnown } from "../util/electra.js" ;
7
7
import { computeStartSlotAtEpoch } from "../util/epoch.js" ;
8
8
import { getActivationExitChurnLimit } from "../util/validator.js" ;
9
9
@@ -51,7 +51,7 @@ export function processPendingDeposits(state: CachedBeaconStateElectra, cache: E
51
51
let isValidatorWithdrawn = false ;
52
52
53
53
const validatorIndex = state . epochCtx . getValidatorIndex ( deposit . pubkey ) ;
54
- if ( validatorIndex !== null ) {
54
+ if ( isValidatorKnown ( state , validatorIndex ) ) {
55
55
const validator = state . validators . getReadonly ( validatorIndex ) ;
56
56
isValidatorExited = validator . exitEpoch < FAR_FUTURE_EPOCH ;
57
57
isValidatorWithdrawn = validator . withdrawableEpoch < nextEpoch ;
@@ -103,7 +103,7 @@ function applyPendingDeposit(
103
103
const { pubkey, withdrawalCredentials, amount, signature} = deposit ;
104
104
const cachedBalances = cache . balances ;
105
105
106
- if ( validatorIndex === null ) {
106
+ if ( ! isValidatorKnown ( state , validatorIndex ) ) {
107
107
// Verify the deposit signature (proof of possession) which is not checked by the deposit contract
108
108
if ( isValidDepositSignature ( state . config , pubkey , withdrawalCredentials , amount , signature ) ) {
109
109
addValidatorToRegistry ( ForkSeq . electra , state , pubkey , withdrawalCredentials , amount ) ;
0 commit comments