fix transfer invariant, credits to @holiman for finding the edge case (#916)
This commit is contained in:
parent
f88f08178e
commit
be86f966f8
|
@ -2416,6 +2416,8 @@ def process_transfer(state: BeaconState, transfer: Transfer) -> None:
|
|||
get_balance(state, transfer.sender) == transfer.amount + transfer.fee or
|
||||
get_balance(state, transfer.sender) >= transfer.amount + transfer.fee + MIN_DEPOSIT_AMOUNT
|
||||
)
|
||||
# No self-transfers (to enforce >= MIN_DEPOSIT_AMOUNT or zero balance invariant)
|
||||
assert transfer.sender != transfer.recipient
|
||||
# A transfer is valid in only one slot
|
||||
assert state.slot == transfer.slot
|
||||
# Only withdrawn or not-yet-deposited accounts can transfer
|
||||
|
|
Loading…
Reference in New Issue