Update 0_beacon-chain.md

This commit is contained in:
Justin 2019-03-11 17:28:39 +01:00 committed by GitHub
parent 02428ec252
commit 0704297480
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 15 deletions

View File

@ -1303,21 +1303,6 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
# create an invalid Merkle branch, it may admit an invalid deposit # create an invalid Merkle branch, it may admit an invalid deposit
# object, and we need to be able to skip over it # object, and we need to be able to skip over it
state.deposit_index += 1 state.deposit_index += 1
# Verify the proof of possession
proof_is_valid = bls_verify(
pubkey=deposit_input.pubkey,
message_hash=signed_root(deposit_input),
signature=deposit_input.proof_of_possession,
domain=get_domain(
state.fork,
get_current_epoch(state),
DOMAIN_DEPOSIT,
)
)
if not proof_is_valid:
return
validator_pubkeys = [v.pubkey for v in state.validator_registry] validator_pubkeys = [v.pubkey for v in state.validator_registry]
pubkey = deposit_input.pubkey pubkey = deposit_input.pubkey
@ -1325,6 +1310,19 @@ def process_deposit(state: BeaconState, deposit: Deposit) -> None:
withdrawal_credentials = deposit_input.withdrawal_credentials withdrawal_credentials = deposit_input.withdrawal_credentials
if pubkey not in validator_pubkeys: if pubkey not in validator_pubkeys:
# Verify the proof of possession
if not bls_verify(
pubkey=deposit_input.pubkey,
message_hash=signed_root(deposit_input),
signature=deposit_input.proof_of_possession,
domain=get_domain(
state.fork,
get_current_epoch(state),
DOMAIN_DEPOSIT,
)
):
return
# Add new validator # Add new validator
validator = Validator( validator = Validator(
pubkey=pubkey, pubkey=pubkey,