Keep payload cache idempotent (#4256)
## Issue Addressed [#4239](https://github.com/sigp/lighthouse/issues/4239) ## Proposed Changes keep the payload cache entry intact after fetching it ## Additional Info
This commit is contained in:
parent
c547a11b0d
commit
744b1950e5
@ -380,7 +380,7 @@ impl<T: EthSpec> ExecutionLayer<T> {
|
|||||||
|
|
||||||
/// Attempt to retrieve a full payload from the payload cache by the payload root
|
/// Attempt to retrieve a full payload from the payload cache by the payload root
|
||||||
pub fn get_payload_by_root(&self, root: &Hash256) -> Option<ExecutionPayload<T>> {
|
pub fn get_payload_by_root(&self, root: &Hash256) -> Option<ExecutionPayload<T>> {
|
||||||
self.inner.payload_cache.pop(root)
|
self.inner.payload_cache.get(root)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn executor(&self) -> &TaskExecutor {
|
pub fn executor(&self) -> &TaskExecutor {
|
||||||
|
@ -30,4 +30,8 @@ impl<T: EthSpec> PayloadCache<T> {
|
|||||||
pub fn pop(&self, root: &Hash256) -> Option<ExecutionPayload<T>> {
|
pub fn pop(&self, root: &Hash256) -> Option<ExecutionPayload<T>> {
|
||||||
self.payloads.lock().pop(&PayloadCacheId(*root))
|
self.payloads.lock().pop(&PayloadCacheId(*root))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get(&self, hash: &Hash256) -> Option<ExecutionPayload<T>> {
|
||||||
|
self.payloads.lock().get(&PayloadCacheId(*hash)).cloned()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user