pub(crate) trait CommittedDeRecShareExt {
fn validate(&self) -> Result<(), crate::Error>;
}
impl CommittedDeRecShareExt for derec_proto::CommittedDeRecShare {
fn validate(&self) -> Result<(), crate::Error> {
if self.de_rec_share.is_empty() {
#[cfg(feature = "logging")]
tracing::warn!("CommittedDeRecShare.de_rec_share is empty");
return Err(crate::Error::Invariant(
"CommittedDeRecShare.de_rec_share is empty",
));
}
if self.commitment.is_empty() {
#[cfg(feature = "logging")]
tracing::warn!("CommittedDeRecShare.commitment is empty");
return Err(crate::Error::Invariant(
"CommittedDeRecShare.commitment is empty",
));
}
if self.merkle_path.is_empty() {
#[cfg(feature = "logging")]
tracing::warn!("CommittedDeRecShare.merkle_path is empty");
return Err(crate::Error::Invariant(
"CommittedDeRecShare.merkle_path is empty",
));
}
Ok(())
}
}