mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Fix Bug In Block Processing with 0x02 Credentials
This commit is contained in:
@@ -566,7 +566,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
|
|||||||
index: withdrawal_index,
|
index: withdrawal_index,
|
||||||
validator_index,
|
validator_index,
|
||||||
address: validator
|
address: validator
|
||||||
.get_eth1_withdrawal_address(spec)
|
.get_execution_withdrawal_address(spec)
|
||||||
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
|
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
|
||||||
amount: balance,
|
amount: balance,
|
||||||
});
|
});
|
||||||
@@ -576,7 +576,7 @@ pub fn get_expected_withdrawals<E: EthSpec>(
|
|||||||
index: withdrawal_index,
|
index: withdrawal_index,
|
||||||
validator_index,
|
validator_index,
|
||||||
address: validator
|
address: validator
|
||||||
.get_eth1_withdrawal_address(spec)
|
.get_execution_withdrawal_address(spec)
|
||||||
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
|
.ok_or(BlockProcessingError::WithdrawalCredentialsInvalid)?,
|
||||||
amount: balance.safe_sub(
|
amount: balance.safe_sub(
|
||||||
validator
|
validator
|
||||||
|
|||||||
@@ -140,18 +140,6 @@ impl Validator {
|
|||||||
is_compounding_withdrawal_credential(self.withdrawal_credentials, spec)
|
is_compounding_withdrawal_credential(self.withdrawal_credentials, spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the eth1 withdrawal address if this validator has one initialized.
|
|
||||||
pub fn get_eth1_withdrawal_address(&self, spec: &ChainSpec) -> Option<Address> {
|
|
||||||
self.has_eth1_withdrawal_credential(spec)
|
|
||||||
.then(|| {
|
|
||||||
self.withdrawal_credentials
|
|
||||||
.as_bytes()
|
|
||||||
.get(12..)
|
|
||||||
.map(Address::from_slice)
|
|
||||||
})
|
|
||||||
.flatten()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the execution withdrawal address if this validator has one initialized.
|
/// Get the execution withdrawal address if this validator has one initialized.
|
||||||
pub fn get_execution_withdrawal_address(&self, spec: &ChainSpec) -> Option<Address> {
|
pub fn get_execution_withdrawal_address(&self, spec: &ChainSpec) -> Option<Address> {
|
||||||
self.has_execution_withdrawal_credential(spec)
|
self.has_execution_withdrawal_credential(spec)
|
||||||
|
|||||||
Reference in New Issue
Block a user