mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-03 04:04:56 -05:00
change proof_is_valid to exit condition
This commit is contained in:
@@ -1259,30 +1259,32 @@ def process_deposit(state: BeaconState,
|
||||
withdrawal_credentials,
|
||||
)
|
||||
|
||||
if proof_is_valid:
|
||||
validator_pubkeys = [v.pubkey for v in state.validator_registry]
|
||||
|
||||
if pubkey not in validator_pubkeys:
|
||||
# Add new validator
|
||||
validator = Validator(
|
||||
pubkey=pubkey,
|
||||
withdrawal_credentials=withdrawal_credentials,
|
||||
activation_epoch=FAR_FUTURE_EPOCH,
|
||||
exit_epoch=FAR_FUTURE_EPOCH,
|
||||
withdrawal_epoch=FAR_FUTURE_EPOCH,
|
||||
penalized_epoch=FAR_FUTURE_EPOCH,
|
||||
status_flags=0,
|
||||
)
|
||||
|
||||
# Note: In phase 2 registry indices that have been withdrawn for a long time will be recycled.
|
||||
state.validator_registry.append(validator)
|
||||
state.validator_balances.append(amount)
|
||||
else:
|
||||
# Increase balance by deposit amount
|
||||
index = validator_pubkeys.index(pubkey)
|
||||
assert state.validator_registry[index].withdrawal_credentials == withdrawal_credentials
|
||||
|
||||
state.validator_balances[index] += amount
|
||||
if not proof_is_valid:
|
||||
return
|
||||
|
||||
validator_pubkeys = [v.pubkey for v in state.validator_registry]
|
||||
|
||||
if pubkey not in validator_pubkeys:
|
||||
# Add new validator
|
||||
validator = Validator(
|
||||
pubkey=pubkey,
|
||||
withdrawal_credentials=withdrawal_credentials,
|
||||
activation_epoch=FAR_FUTURE_EPOCH,
|
||||
exit_epoch=FAR_FUTURE_EPOCH,
|
||||
withdrawal_epoch=FAR_FUTURE_EPOCH,
|
||||
penalized_epoch=FAR_FUTURE_EPOCH,
|
||||
status_flags=0,
|
||||
)
|
||||
|
||||
# Note: In phase 2 registry indices that have been withdrawn for a long time will be recycled.
|
||||
state.validator_registry.append(validator)
|
||||
state.validator_balances.append(amount)
|
||||
else:
|
||||
# Increase balance by deposit amount
|
||||
index = validator_pubkeys.index(pubkey)
|
||||
assert state.validator_registry[index].withdrawal_credentials == withdrawal_credentials
|
||||
|
||||
state.validator_balances[index] += amount
|
||||
```
|
||||
|
||||
### Routines for updating validator status
|
||||
|
||||
Reference in New Issue
Block a user