mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 13:54:44 +00:00
add consolidation processing
This commit is contained in:
@@ -160,6 +160,7 @@ pub enum Error {
|
||||
InvalidFlagIndex(usize),
|
||||
MerkleTreeError(merkle_proof::MerkleTreeError),
|
||||
PartialWithdrawalCountInvalid(usize),
|
||||
NonExecutionAddresWithdrawalCredential,
|
||||
}
|
||||
|
||||
/// Control whether an epoch-indexed field can be indexed at the next epoch or not.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::test_utils::TestRandom;
|
||||
use crate::Epoch;
|
||||
use crate::{test_utils::TestRandom, SignedRoot};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use ssz_derive::{Decode, Encode};
|
||||
use test_random_derive::TestRandom;
|
||||
@@ -27,6 +27,8 @@ pub struct Consolidation {
|
||||
pub epoch: Epoch,
|
||||
}
|
||||
|
||||
impl SignedRoot for Consolidation {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -142,6 +142,18 @@ impl Validator {
|
||||
.flatten()
|
||||
}
|
||||
|
||||
/// Get the execution withdrawal address if this validator has one initialized.
|
||||
pub fn get_execution_withdrawal_address(&self, spec: &ChainSpec) -> Option<Address> {
|
||||
self.has_execution_withdrawal_credential(spec)
|
||||
.then(|| {
|
||||
self.withdrawal_credentials
|
||||
.as_bytes()
|
||||
.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