mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-01 10:04:57 -05:00
Rewrite verify to use izip!
This commit is contained in:
parent
2c6e917554
commit
1e973e5bbd
@ -108,23 +108,20 @@ pub fn verify(
|
||||
|
||||
let adjusted_commitment_ring = commitment_ring.map(|point| point - pseudo_output_commitment);
|
||||
|
||||
let mut h = h_0;
|
||||
|
||||
for (i, s_i) in responses.iter().enumerate() {
|
||||
let pk_i = ring[i % RING_SIZE];
|
||||
|
||||
let adjusted_commitment_i = adjusted_commitment_ring[i % RING_SIZE];
|
||||
|
||||
let h_0_computed = itertools::izip!(responses, ring, adjusted_commitment_ring).fold(
|
||||
h_0,
|
||||
|h, (s_i, pk_i, adjusted_commitment_i)| {
|
||||
dbg!(hex::encode(h.as_bytes()));
|
||||
dbg!(hex::encode(pk_i.compress().as_bytes()));
|
||||
dbg!(hex::encode(adjusted_commitment_i.compress().as_bytes()));
|
||||
|
||||
let L_i = compute_L(h, mu_P, mu_C, *s_i, pk_i, adjusted_commitment_i);
|
||||
let R_i = compute_R(h, mu_P, mu_C, *s_i, pk_i, I, D);
|
||||
let L_i = compute_L(h, mu_P, mu_C, s_i, *pk_i, adjusted_commitment_i);
|
||||
let R_i = compute_R(h, mu_P, mu_C, s_i, *pk_i, I, D);
|
||||
|
||||
dbg!(hex::encode(L_i.compress().as_bytes()));
|
||||
dbg!(hex::encode(R_i.compress().as_bytes()));
|
||||
|
||||
h = hash_to_scalar!(
|
||||
hash_to_scalar!(
|
||||
b"CLSAG_round"
|
||||
|| ring
|
||||
|| commitment_ring
|
||||
@ -132,12 +129,11 @@ pub fn verify(
|
||||
|| msg
|
||||
|| L_i
|
||||
|| R_i
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
dbg!(hex::encode(h.as_bytes()));
|
||||
}
|
||||
|
||||
h == h_0
|
||||
h_0_computed == h_0
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user