@@ -30,7 +30,6 @@ use crate::eth1_finalization_cache::{Eth1FinalizationCache, Eth1FinalizationData
3030use crate :: events:: ServerSentEventHandler ;
3131use crate :: execution_payload:: { get_execution_payload, NotifyExecutionLayer , PreparePayloadHandle } ;
3232use crate :: fork_choice_signal:: { ForkChoiceSignalRx , ForkChoiceSignalTx , ForkChoiceWaitResult } ;
33- use crate :: head_tracker:: HeadTracker ;
3433use crate :: historical_blocks:: HistoricalBlockError ;
3534use crate :: light_client_finality_update_verification:: {
3635 Error as LightClientFinalityUpdateError , VerifiedLightClientFinalityUpdate ,
@@ -53,7 +52,6 @@ use crate::observed_blob_sidecars::ObservedBlobSidecars;
5352use crate :: observed_block_producers:: ObservedBlockProducers ;
5453use crate :: observed_operations:: { ObservationOutcome , ObservedOperations } ;
5554use crate :: observed_slashable:: ObservedSlashable ;
56- use crate :: persisted_beacon_chain:: { PersistedBeaconChain , DUMMY_CANONICAL_HEAD_BLOCK_ROOT } ;
5755use crate :: persisted_fork_choice:: PersistedForkChoice ;
5856use crate :: pre_finalization_cache:: PreFinalizationBlockCache ;
5957use crate :: shuffling_cache:: { BlockShufflingIds , ShufflingCache } ;
@@ -113,9 +111,7 @@ use std::marker::PhantomData;
113111use std:: sync:: Arc ;
114112use std:: time:: { Duration , Instant } ;
115113use store:: iter:: { BlockRootsIterator , ParentRootBlockIterator , StateRootsIterator } ;
116- use store:: {
117- DatabaseBlock , Error as DBError , HotColdDB , KeyValueStore , KeyValueStoreOp , StoreItem , StoreOp ,
118- } ;
114+ use store:: { DatabaseBlock , Error as DBError , HotColdDB , KeyValueStore , StoreOp } ;
119115use task_executor:: { ShutdownReason , TaskExecutor } ;
120116use tokio_stream:: Stream ;
121117use tree_hash:: TreeHash ;
@@ -446,8 +442,6 @@ pub struct BeaconChain<T: BeaconChainTypes> {
446442 /// A handler for events generated by the beacon chain. This is only initialized when the
447443 /// HTTP server is enabled.
448444 pub event_handler : Option < ServerSentEventHandler < T :: EthSpec > > ,
449- /// Used to track the heads of the beacon chain.
450- pub ( crate ) head_tracker : Arc < HeadTracker > ,
451445 /// A cache dedicated to block processing.
452446 pub ( crate ) snapshot_cache : TimeoutRwLock < SnapshotCache < T :: EthSpec > > ,
453447 /// Caches the attester shuffling for a given epoch and shuffling key root.
@@ -609,9 +603,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
609603 pub fn persist_head_and_fork_choice ( & self ) -> Result < ( ) , Error > {
610604 let mut batch = vec ! [ ] ;
611605
612- let _head_timer = metrics:: start_timer ( & metrics:: PERSIST_HEAD ) ;
613- batch. push ( self . persist_head_in_batch ( ) ) ;
614-
615606 let _fork_choice_timer = metrics:: start_timer ( & metrics:: PERSIST_FORK_CHOICE ) ;
616607 batch. push ( self . persist_fork_choice_in_batch ( ) ) ;
617608
@@ -620,31 +611,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
620611 Ok ( ( ) )
621612 }
622613
623- /// Return a `PersistedBeaconChain` without reference to a `BeaconChain`.
624- pub fn make_persisted_head (
625- genesis_block_root : Hash256 ,
626- head_tracker : & HeadTracker ,
627- ) -> PersistedBeaconChain {
628- PersistedBeaconChain {
629- _canonical_head_block_root : DUMMY_CANONICAL_HEAD_BLOCK_ROOT ,
630- genesis_block_root,
631- ssz_head_tracker : head_tracker. to_ssz_container ( ) ,
632- }
633- }
634-
635- /// Return a database operation for writing the beacon chain head to disk.
636- pub fn persist_head_in_batch ( & self ) -> KeyValueStoreOp {
637- Self :: persist_head_in_batch_standalone ( self . genesis_block_root , & self . head_tracker )
638- }
639-
640- pub fn persist_head_in_batch_standalone (
641- genesis_block_root : Hash256 ,
642- head_tracker : & HeadTracker ,
643- ) -> KeyValueStoreOp {
644- Self :: make_persisted_head ( genesis_block_root, head_tracker)
645- . as_kv_store_op ( BEACON_CHAIN_DB_KEY )
646- }
647-
648614 /// Load fork choice from disk, returning `None` if it isn't found.
649615 pub fn load_fork_choice (
650616 store : BeaconStore < T > ,
@@ -1338,11 +1304,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
13381304 ///
13391305 /// Returns `(block_root, block_slot)`.
13401306 pub fn heads ( & self ) -> Vec < ( Hash256 , Slot ) > {
1341- self . head_tracker . heads ( )
1307+ todo ! ( ) ;
1308+ // self.head_tracker.heads()
13421309 }
13431310
1311+ /// Only used in tests
13441312 pub fn knows_head ( & self , block_hash : & SignedBeaconBlockHash ) -> bool {
1345- self . head_tracker . contains_head ( ( * block_hash) . into ( ) )
1313+ let block_hash = ( * block_hash) . into ( ) ;
1314+ self . heads ( ) . iter ( ) . any ( |head| head. 0 == block_hash)
13461315 }
13471316
13481317 /// Returns the `BeaconState` at the given slot.
@@ -3533,9 +3502,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
35333502 ) ;
35343503 } ) ;
35353504
3536- self . head_tracker
3537- . register_block ( block_root, parent_root, slot) ;
3538-
35393505 metrics:: stop_timer ( db_write_timer) ;
35403506
35413507 metrics:: inc_counter ( & metrics:: BLOCK_PROCESSING_SUCCESSES ) ;
0 commit comments