mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
Import validated IL's into IL cache
This commit is contained in:
@@ -471,7 +471,7 @@ pub struct BeaconChain<T: BeaconChainTypes> {
|
||||
/// A cache used when producing attestations whilst the head block is still being imported.
|
||||
pub early_attester_cache: EarlyAttesterCache<T::EthSpec>,
|
||||
/// A cache used to store verified/equivocating inclusion lists.
|
||||
pub inclusion_list_cache: InclusionListCache<T::EthSpec>,
|
||||
pub inclusion_list_cache: RwLock<InclusionListCache<T::EthSpec>>,
|
||||
/// Cache gossip verified blocks to serve over ReqResp before they are imported
|
||||
pub reqresp_pre_import_cache: Arc<RwLock<ReqRespPreImportCache<T::EthSpec>>>,
|
||||
/// A cache used to keep track of various block timings.
|
||||
@@ -7293,6 +7293,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn on_verified_inclusion_list(&self, signed_il: SignedInclusionList<T::EthSpec>) {
|
||||
self.inclusion_list_cache.write().on_inclusion_list(signed_il);
|
||||
}
|
||||
|
||||
pub fn metrics(&self) -> BeaconChainMetrics {
|
||||
BeaconChainMetrics {
|
||||
reqresp_pre_import_cache_len: self.reqresp_pre_import_cache.read().len(),
|
||||
|
||||
@@ -105,6 +105,7 @@ impl<T: BeaconChainTypes> PayloadNotifier<T> {
|
||||
|
||||
let inclusion_list_transactions = chain
|
||||
.inclusion_list_cache
|
||||
.read()
|
||||
.get_inclusion_list_transactions(block.slot())
|
||||
.unwrap_or(vec![].into());
|
||||
|
||||
|
||||
@@ -29,9 +29,7 @@ impl From<BeaconChainError> for GossipInclusionListError {
|
||||
}
|
||||
|
||||
pub struct GossipVerifiedInclusionList<T: BeaconChainTypes> {
|
||||
// TODO(focil) remove once this field is read
|
||||
#[allow(dead_code)]
|
||||
signed_il: SignedInclusionList<T::EthSpec>,
|
||||
pub signed_il: SignedInclusionList<T::EthSpec>,
|
||||
}
|
||||
|
||||
impl<T: BeaconChainTypes> GossipVerifiedInclusionList<T> {
|
||||
|
||||
@@ -2174,8 +2174,11 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
_seen_timestamp: Duration,
|
||||
) {
|
||||
match GossipVerifiedInclusionList::verify(&il, &self.chain) {
|
||||
Ok(_gossip_verified_il) => {
|
||||
Ok(gossip_verified_il) => {
|
||||
debug!(self.log, "Successfully verified gossip inclusion list");
|
||||
// Store validated inclusion list in the IL cache. This also catches
|
||||
// equivocating IL's and handles them accordingly.
|
||||
self.chain.on_verified_inclusion_list(gossip_verified_il.signed_il);
|
||||
}
|
||||
Err(err) => match err {
|
||||
GossipInclusionListError::FutureSlot { .. }
|
||||
|
||||
Reference in New Issue
Block a user