use super::Variant; use crate::simplex::{ scheme::Scheme, types::{Finalization, Notarization}, }; use commonware_cryptography::certificate::{Scheme as CertificateScheme, Scoped}; use commonware_utils::channel::oneshot; /// A parsed-but-unverified resolver delivery awaiting batch certificate verification. /// /// Each item carries the scope it was admitted under so verification does not /// depend on the provider still serving that epoch. pub(super) enum PendingVerification where S: Scheme, { Notarized { scoped: Scoped, notarization: Notarization, block: V::Block, response: oneshot::Sender, }, Finalized { scoped: Scoped, finalization: Finalization, block: V::ApplicationBlock, response: oneshot::Sender, }, } impl PendingVerification where S: Scheme, { /// Returns the scope the delivery was admitted under. pub(super) const fn scoped(&self) -> &Scoped { match self { Self::Notarized { scoped, .. } | Self::Finalized { scoped, .. } => scoped, } } pub(super) fn response_closed(&self) -> bool { match self { Self::Notarized { response, .. } | Self::Finalized { response, .. } => { response.is_closed() } } } }