use bc::TxOut;
use commit_verify::mpc::Commitment;
use commit_verify::{EmbedCommitProof, EmbedCommitVerify, EmbedVerifyError};
use crate::opret::{OpretError, OpretFirst, OpretProof};
impl EmbedCommitProof<Commitment, TxOut, OpretFirst> for OpretProof {
fn restore_original_container(
&self,
commit_container: &TxOut,
) -> Result<TxOut, EmbedVerifyError<OpretError>> {
let mut txout = commit_container.clone();
txout.script_pubkey = self.restore_original_container(&txout.script_pubkey)?;
Ok(txout)
}
}
impl EmbedCommitVerify<Commitment, OpretFirst> for TxOut {
type Proof = OpretProof;
type CommitError = OpretError;
fn embed_commit(&mut self, msg: &Commitment) -> Result<Self::Proof, Self::CommitError> {
self.script_pubkey.embed_commit(msg)
}
}