b84ff9f793
## Issue Addressed `make lint` failing on rust 1.53.0. ## Proposed Changes 1.53.0 updates ## Additional Info I haven't figure out why yet, we were now hitting the recursion limit in a few crates. So I had to add `#![recursion_limit = "256"]` in a few places Co-authored-by: realbigsean <seananderson33@gmail.com> Co-authored-by: Michael Sproul <michael@sigmaprime.io>
27 lines
590 B
Rust
27 lines
590 B
Rust
use parking_lot::Mutex;
|
|
use types::SignedBeaconBlockHeader;
|
|
|
|
#[derive(Debug, Default)]
|
|
pub struct BlockQueue {
|
|
blocks: Mutex<Vec<SignedBeaconBlockHeader>>,
|
|
}
|
|
|
|
impl BlockQueue {
|
|
pub fn queue(&self, block_header: SignedBeaconBlockHeader) {
|
|
self.blocks.lock().push(block_header)
|
|
}
|
|
|
|
pub fn dequeue(&self) -> Vec<SignedBeaconBlockHeader> {
|
|
let mut blocks = self.blocks.lock();
|
|
std::mem::take(&mut *blocks)
|
|
}
|
|
|
|
pub fn len(&self) -> usize {
|
|
self.blocks.lock().len()
|
|
}
|
|
|
|
pub fn is_empty(&self) -> bool {
|
|
self.len() == 0
|
|
}
|
|
}
|