mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-03 06:13:31 +00:00
Simplify test helpers
This commit is contained in:
parent
5270d7913d
commit
f2e45fb774
@ -4,12 +4,11 @@ from eth2spec.test.helpers.withdrawals import (
|
||||
|
||||
|
||||
def prepare_switch_to_compounding_request(spec, state, validator_index, address=None):
|
||||
if address is not None:
|
||||
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
|
||||
|
||||
validator = state.validators[validator_index]
|
||||
if not spec.has_execution_withdrawal_credential(validator):
|
||||
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index)
|
||||
|
||||
# Set the supplied address or the default one if needed
|
||||
if address is not None or not spec.has_execution_withdrawal_credential(validator):
|
||||
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
|
||||
|
||||
return spec.ConsolidationRequest(
|
||||
source_address=state.validators[validator_index].withdrawal_credentials[12:],
|
||||
|
@ -139,12 +139,11 @@ def prepare_pending_withdrawal(spec, state, validator_index,
|
||||
|
||||
|
||||
def prepare_withdrawal_request(spec, state, validator_index, address=None, amount=None):
|
||||
if address is not None:
|
||||
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
|
||||
|
||||
validator = state.validators[validator_index]
|
||||
if not spec.has_execution_withdrawal_credential(validator):
|
||||
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index)
|
||||
|
||||
# Set the supplied address or the default one if needed
|
||||
if address is not None or not spec.has_execution_withdrawal_credential(validator):
|
||||
set_eth1_withdrawal_credential_with_balance(spec, state, validator_index, address=address)
|
||||
|
||||
if amount is None:
|
||||
amount = spec.FULL_EXIT_REQUEST_AMOUNT
|
||||
|
Loading…
x
Reference in New Issue
Block a user