1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use bitcoin::{Script, TxOut};
use commit_verify::convolve_commit::{
ConvolveCommitProof, ConvolveCommitVerify,
};
use commit_verify::lnpbp4;
use super::{Lnpbp6, TapretProof, TapretTreeError};
impl ConvolveCommitProof<lnpbp4::CommitmentHash, TxOut, Lnpbp6>
for TapretProof
{
type Suppl = Self;
fn restore_original(&self, commitment: &TxOut) -> TxOut {
TxOut {
value: commitment.value,
script_pubkey: self.original_pubkey_script().into(),
}
}
fn extract_supplement(&self) -> &Self::Suppl { self }
}
impl ConvolveCommitVerify<lnpbp4::CommitmentHash, TapretProof, Lnpbp6>
for TxOut
{
type Commitment = TxOut;
type CommitError = TapretTreeError;
fn convolve_commit(
&self,
supplement: &TapretProof,
msg: &lnpbp4::CommitmentHash,
) -> Result<(TxOut, TapretProof), Self::CommitError> {
let (output_key, _) = supplement
.internal_key
.convolve_commit(&supplement.path_proof, msg)?;
let script_pubkey = Script::new_v1_p2tr_tweaked(output_key);
let commitment = TxOut {
value: self.value,
script_pubkey,
};
Ok((commitment, supplement.clone()))
}
}