Merge pull request #1213 from ethereum/ralexstokes-patch-2

Clarify comment on phase 0 transfers
This commit is contained in:
Danny Ryan 2019-06-24 16:43:50 -06:00 committed by GitHub
commit b5581983f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -1807,10 +1807,13 @@ def process_transfer(state: BeaconState, transfer: Transfer) -> None:
assert state.balances[transfer.sender] >= max(transfer.amount, transfer.fee) assert state.balances[transfer.sender] >= max(transfer.amount, transfer.fee)
# A transfer is valid in only one slot # A transfer is valid in only one slot
assert state.slot == transfer.slot assert state.slot == transfer.slot
# Sender must be not yet eligible for activation, withdrawn, or transfer balance over MAX_EFFECTIVE_BALANCE # Sender must satisfy at least one of the following conditions in the parenthesis:
assert ( assert (
# * Has not been activated
state.validators[transfer.sender].activation_eligibility_epoch == FAR_FUTURE_EPOCH or state.validators[transfer.sender].activation_eligibility_epoch == FAR_FUTURE_EPOCH or
# * Is withdrawable
get_current_epoch(state) >= state.validators[transfer.sender].withdrawable_epoch or get_current_epoch(state) >= state.validators[transfer.sender].withdrawable_epoch or
# * Balance after transfer is more than the effective balance threshold
transfer.amount + transfer.fee + MAX_EFFECTIVE_BALANCE <= state.balances[transfer.sender] transfer.amount + transfer.fee + MAX_EFFECTIVE_BALANCE <= state.balances[transfer.sender]
) )
# Verify that the pubkey is valid # Verify that the pubkey is valid