Made topping up a withdrawn account impossible

This commit is contained in:
vbuterin 2018-11-27 13:23:26 -05:00 committed by GitHub
parent 8b8253cdb2
commit efdafee1ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -783,14 +783,12 @@ def add_validator(state: State,
state.validators[index] = rec state.validators[index] = rec
return index return index
else: else:
assert val.status != WITHDRAWN
index = validator_pubkeys.index(pubkey) index = validator_pubkeys.index(pubkey)
val = state.validators[index] val = state.validators[index]
assert val.withdrawal_credentials == withdrawal_credentials assert val.withdrawal_credentials == withdrawal_credentials
assert deposit_size >= MIN_TOPUP_SIZE assert deposit_size >= MIN_TOPUP_SIZE
val.balance += deposit_size val.balance += deposit_size
# If the validator is withdrawn, overwrite it with the new validator data
if val.status == WITHDRAWN:
state.validators[index] = rec
return index return index
``` ```