mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Add block to fock choice before db
This commit is contained in:
@@ -1353,6 +1353,24 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
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
|
// Store all the states between the parent block state and this blocks slot before storing
|
||||||
@@ -1387,24 +1405,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
|
|
||||||
self.head_tracker.register_block(block_root, &block);
|
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::inc_counter(&metrics::BLOCK_PROCESSING_SUCCESSES);
|
||||||
metrics::observe(
|
metrics::observe(
|
||||||
&metrics::OPERATIONS_PER_BLOCK_ATTESTATION,
|
&metrics::OPERATIONS_PER_BLOCK_ATTESTATION,
|
||||||
|
|||||||
Reference in New Issue
Block a user