mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-11 18:04:18 +00:00
Cleanup
This commit is contained in:
@@ -656,7 +656,19 @@ fn is_valid_switch_to_compounding_request<E: EthSpec>(
|
||||
return false;
|
||||
};
|
||||
// Verify the source withdrawal credentials
|
||||
if let Some(withdrawal_address) = source_validator.get_eth1_withdrawal_credential(spec) {
|
||||
// Note: We need to specifically check for eth1 withdrawal credentials here
|
||||
// If the validator is already compounding, the compounding request is not valid.
|
||||
if let Some(withdrawal_address) = source_validator
|
||||
.has_eth1_withdrawal_credential(spec)
|
||||
.then(|| {
|
||||
source_validator
|
||||
.withdrawal_credentials
|
||||
.as_slice()
|
||||
.get(12..)
|
||||
.map(Address::from_slice)
|
||||
})
|
||||
.flatten()
|
||||
{
|
||||
if withdrawal_address != consolidation_request.source_address {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -181,17 +181,6 @@ impl Validator {
|
||||
.flatten()
|
||||
}
|
||||
|
||||
pub fn get_eth1_withdrawal_credential(&self, spec: &ChainSpec) -> Option<Address> {
|
||||
self.has_eth1_withdrawal_credential(spec)
|
||||
.then(|| {
|
||||
self.withdrawal_credentials
|
||||
.as_slice()
|
||||
.get(12..)
|
||||
.map(Address::from_slice)
|
||||
})
|
||||
.flatten()
|
||||
}
|
||||
|
||||
/// Changes withdrawal credentials to the provided eth1 execution address.
|
||||
///
|
||||
/// WARNING: this function does NO VALIDATION - it just does it!
|
||||
|
||||
Reference in New Issue
Block a user