mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 11:41:51 +00:00
Update pool/attestations and committees endpoints (#1899)
## Issue Addressed
Catching up on a few eth2 spec updates:
## Proposed Changes
- adding query params to the `GET pool/attestations` endpoint
- allowing the `POST pool/attestations` endpoint to accept an array of attestations
- batching attestation submission
- moving `epoch` from a path param to a query param in the `committees` endpoint
## Additional Info
Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -344,6 +344,22 @@ impl<T: EthSpec> OperationPool<T> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Returns all known `Attestation` objects that pass the provided filter.
|
||||
///
|
||||
/// This method may return objects that are invalid for block inclusion.
|
||||
pub fn get_filtered_attestations<F>(&self, filter: F) -> Vec<Attestation<T>>
|
||||
where
|
||||
F: Fn(&Attestation<T>) -> bool,
|
||||
{
|
||||
self.attestations
|
||||
.read()
|
||||
.iter()
|
||||
.map(|(_, attns)| attns.iter().cloned())
|
||||
.flatten()
|
||||
.filter(filter)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Returns all known `AttesterSlashing` objects.
|
||||
///
|
||||
/// This method may return objects that are invalid for block inclusion.
|
||||
|
||||
Reference in New Issue
Block a user