mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 02:12:33 +00:00
Serve rpc by range and by root:
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::DatabasePayloadEnvelope;
|
||||
use crate::config::{OnDiskStoreConfig, StoreConfig};
|
||||
use crate::database::interface::BeaconNodeBackend;
|
||||
use crate::forwards_iter::{HybridForwardsBlockRootsIterator, HybridForwardsStateRootsIterator};
|
||||
@@ -745,6 +746,27 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
pub fn try_get_full_payload_envelope(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
) -> Result<Option<DatabasePayloadEnvelope<E>>, Error> {
|
||||
// TODO(gloas) metrics
|
||||
// metrics::inc_counter(&metrics::PAYLOAD_ENVELOPE_GET_COUNT);
|
||||
|
||||
// Load the execution payload envelope
|
||||
// TODO(gloas) we'll want to implement a way to load a blinded envelope
|
||||
let Some(envelope) = self.get_payload_envelope(block_root)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(Some(DatabasePayloadEnvelope::Full(envelope)))
|
||||
|
||||
// TODO(gloas) implement the logic described below (see `try_get_full_block`)
|
||||
// If the payload envelope is after the split point then we should have the full execution payload
|
||||
// stored in the database. If it isn't but payload pruning is disabled, try to load it
|
||||
// on-demand.
|
||||
}
|
||||
|
||||
pub fn get_payload_envelope(
|
||||
&self,
|
||||
block_root: &Hash256,
|
||||
|
||||
@@ -390,6 +390,13 @@ pub enum DatabaseBlock<E: EthSpec> {
|
||||
Blinded(SignedBeaconBlock<E, BlindedPayload<E>>),
|
||||
}
|
||||
|
||||
/// An execution payload envelope from the database
|
||||
// TODO(gloas) implement blinded variant
|
||||
pub enum DatabasePayloadEnvelope<E: EthSpec> {
|
||||
Full(SignedExecutionPayloadEnvelope<E>),
|
||||
Blinded(SignedExecutionPayloadEnvelope<E>),
|
||||
}
|
||||
|
||||
impl DBColumn {
|
||||
pub fn as_str(self) -> &'static str {
|
||||
self.into()
|
||||
|
||||
Reference in New Issue
Block a user