mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
block verification changes
This commit is contained in:
@@ -383,10 +383,7 @@ impl ProtoArray {
|
||||
/// Updates the node's `payload_status` from `PENDING` to `FULL`.
|
||||
///
|
||||
/// Returns an error if the block is unknown to fork choice.
|
||||
pub fn on_execution_payload(
|
||||
&mut self,
|
||||
block_root: Hash256,
|
||||
) -> Result<(), Error> {
|
||||
pub fn on_execution_payload(&mut self, block_root: Hash256) -> Result<(), Error> {
|
||||
let index = self
|
||||
.indices
|
||||
.get(&block_root)
|
||||
|
||||
@@ -491,10 +491,7 @@ impl ProtoArrayForkChoice {
|
||||
/// Register that a valid execution payload envelope has been received for `block_root`.
|
||||
///
|
||||
/// See `ProtoArray::on_execution_payload` for documentation.
|
||||
pub fn on_execution_payload(
|
||||
&mut self,
|
||||
block_root: Hash256,
|
||||
) -> Result<(), String> {
|
||||
pub fn on_execution_payload(&mut self, block_root: Hash256) -> Result<(), String> {
|
||||
self.proto_array
|
||||
.on_execution_payload(block_root)
|
||||
.map_err(|e| format!("on_execution_payload error: {:?}", e))
|
||||
@@ -899,6 +896,16 @@ impl ProtoArrayForkChoice {
|
||||
Some(block.execution_status)
|
||||
}
|
||||
|
||||
/// Returns the first *beacon block root* which contains an execution payload with the given
|
||||
/// `block_hash`, if any.
|
||||
pub fn execution_block_hash_to_beacon_block_root(
|
||||
&self,
|
||||
block_hash: &ExecutionBlockHash,
|
||||
) -> Option<Hash256> {
|
||||
self.proto_array
|
||||
.execution_block_hash_to_beacon_block_root(block_hash)
|
||||
}
|
||||
|
||||
/// Returns the weight of a given block.
|
||||
pub fn get_weight(&self, block_root: &Hash256) -> Option<u64> {
|
||||
let block_index = self.proto_array.indices.get(block_root)?;
|
||||
|
||||
Reference in New Issue
Block a user