@@ -1664,28 +1664,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
16641664 /// Returns an aggregated `Attestation`, if any, that has a matching `attestation.data`.
16651665 ///
16661666 /// The attestation will be obtained from `self.naive_aggregation_pool`.
1667- pub fn get_aggregated_attestation_base (
1668- & self ,
1669- data : & AttestationData ,
1670- ) -> Result < Option < Attestation < T :: EthSpec > > , Error > {
1671- let attestation_key = crate :: naive_aggregation_pool:: AttestationKey :: new_base ( data) ;
1672- if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( & attestation_key) {
1673- self . filter_optimistic_attestation ( attestation)
1674- . map ( Option :: Some )
1675- } else {
1676- Ok ( None )
1677- }
1678- }
1679-
1680- // TODO(electra): call this function from the new beacon API method
1681- pub fn get_aggregated_attestation_electra (
1667+ pub fn get_aggregated_attestation (
16821668 & self ,
16831669 data : & AttestationData ,
1684- committee_index : CommitteeIndex ,
16851670 ) -> Result < Option < Attestation < T :: EthSpec > > , Error > {
1686- let attestation_key =
1687- crate :: naive_aggregation_pool:: AttestationKey :: new_electra ( data, committee_index) ;
1688- if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( & attestation_key) {
1671+ if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( data) {
16891672 self . filter_optimistic_attestation ( attestation)
16901673 . map ( Option :: Some )
16911674 } else {
@@ -1697,21 +1680,16 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
16971680 /// `attestation.data.tree_hash_root()`.
16981681 ///
16991682 /// The attestation will be obtained from `self.naive_aggregation_pool`.
1700- ///
1701- /// NOTE: This function will *only* work with pre-electra attestations and it only
1702- /// exists to support the pre-electra validator API method.
1703- pub fn get_pre_electra_aggregated_attestation_by_slot_and_root (
1683+ pub fn get_aggregated_attestation_by_slot_and_root (
17041684 & self ,
17051685 slot : Slot ,
17061686 attestation_data_root : & Hash256 ,
17071687 ) -> Result < Option < Attestation < T :: EthSpec > > , Error > {
1708- let attestation_key =
1709- crate :: naive_aggregation_pool:: AttestationKey :: new_base_from_slot_and_root (
1710- slot,
1711- * attestation_data_root,
1712- ) ;
1713-
1714- if let Some ( attestation) = self . naive_aggregation_pool . read ( ) . get ( & attestation_key) {
1688+ if let Some ( attestation) = self
1689+ . naive_aggregation_pool
1690+ . read ( )
1691+ . get_by_slot_and_root ( slot, attestation_data_root)
1692+ {
17151693 self . filter_optimistic_attestation ( attestation)
17161694 . map ( Option :: Some )
17171695 } else {
0 commit comments