use super::Variant; use crate::simplex::{ scheme::Scheme, types::{Finalization, Notarization}, }; use bytes::Bytes; use commonware_cryptography::{Digested, certificate::Scoped}; use commonware_resolver::Outcome; use commonware_utils::channel::oneshot; /// A resolver delivery whose certificate is parsed and awaits batch 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: Bytes, response: oneshot::Sender, }, Finalized { scoped: Scoped, finalization: Finalization, block: Digested, 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() } } } }