diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index da70e77f3c..dad9459fd1 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -1353,6 +1353,24 @@ impl BeaconChain { }); } + let fork_choice_register_timer = + metrics::start_timer(&metrics::BLOCK_PROCESSING_FORK_CHOICE_REGISTER); + + // Register the new block with the fork choice service. + if let Err(e) = self + .fork_choice + .process_block(self, &state, &block, block_root) + { + error!( + self.log, + "Add block to fork choice failed"; + "block_root" => format!("{}", block_root), + "error" => format!("{:?}", e), + ) + } + + metrics::stop_timer(fork_choice_register_timer); + let db_write_timer = metrics::start_timer(&metrics::BLOCK_PROCESSING_DB_WRITE); // Store all the states between the parent block state and this blocks slot before storing @@ -1387,24 +1405,6 @@ impl BeaconChain { self.head_tracker.register_block(block_root, &block); - let fork_choice_register_timer = - metrics::start_timer(&metrics::BLOCK_PROCESSING_FORK_CHOICE_REGISTER); - - // Register the new block with the fork choice service. - if let Err(e) = self - .fork_choice - .process_block(self, &state, &block, block_root) - { - error!( - self.log, - "Add block to fork choice failed"; - "block_root" => format!("{}", block_root), - "error" => format!("{:?}", e), - ) - } - - metrics::stop_timer(fork_choice_register_timer); - metrics::inc_counter(&metrics::BLOCK_PROCESSING_SUCCESSES); metrics::observe( &metrics::OPERATIONS_PER_BLOCK_ATTESTATION,