@@ -1612,28 +1612,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
1612
1612
/// Returns an aggregated `Attestation`, if any, that has a matching `attestation.data`.
1613
1613
///
1614
1614
/// The attestation will be obtained from `self.naive_aggregation_pool`.
1615
- pub fn get_aggregated_attestation_base (
1615
+ pub fn get_aggregated_attestation (
1616
1616
& self ,
1617
1617
data : & AttestationData ,
1618
1618
) -> Result < Option < Attestation < T :: EthSpec > > , Error > {
1619
- let attestation_key = crate :: naive_aggregation_pool:: AttestationKey :: new_base ( data) ;
1620
- if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( & attestation_key) {
1621
- self . filter_optimistic_attestation ( attestation)
1622
- . map ( Option :: Some )
1623
- } else {
1624
- Ok ( None )
1625
- }
1626
- }
1627
-
1628
- // TODO(electra): call this function from the new beacon API method
1629
- pub fn get_aggregated_attestation_electra (
1630
- & self ,
1631
- data : & AttestationData ,
1632
- committee_index : CommitteeIndex ,
1633
- ) -> Result < Option < Attestation < T :: EthSpec > > , Error > {
1634
- let attestation_key =
1635
- crate :: naive_aggregation_pool:: AttestationKey :: new_electra ( data, committee_index) ;
1636
- if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( & attestation_key) {
1619
+ if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( data) {
1637
1620
self . filter_optimistic_attestation ( attestation)
1638
1621
. map ( Option :: Some )
1639
1622
} else {
@@ -1645,21 +1628,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
1645
1628
/// `attestation.data.tree_hash_root()`.
1646
1629
///
1647
1630
/// The attestation will be obtained from `self.naive_aggregation_pool`.
1648
- ///
1649
- /// NOTE: This function will *only* work with pre-electra attestations and it only
1650
- /// exists to support the pre-electra validator API method.
1651
- pub fn get_pre_electra_aggregated_attestation_by_slot_and_root (
1631
+ pub fn get_aggregated_attestation_by_slot_and_root (
1652
1632
& self ,
1653
1633
slot : Slot ,
1654
1634
attestation_data_root : & Hash256 ,
1655
1635
) -> Result < Option < Attestation < T :: EthSpec > > , Error > {
1656
- let attestation_key =
1657
- crate :: naive_aggregation_pool:: AttestationKey :: new_base_from_slot_and_root (
1658
- slot,
1659
- * attestation_data_root,
1660
- ) ;
1661
-
1662
- if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( & attestation_key) {
1636
+ if let Some ( attestation) = self
1637
+ . naive_aggregation_pool
1638
+ . read ( )
1639
+ . get_by_slot_and_root ( slot, attestation_data_root)
1640
+ {
1663
1641
self . filter_optimistic_attestation ( attestation)
1664
1642
. map ( Option :: Some )
1665
1643
} else {
0 commit comments