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,36 +108,32 @@ pub fn verify(
|
|||||||
|
|
||||||
let adjusted_commitment_ring = commitment_ring.map(|point| point - pseudo_output_commitment);
|
let adjusted_commitment_ring = commitment_ring.map(|point| point - pseudo_output_commitment);
|
||||||
|
|
||||||
let mut h = h_0;
|
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()));
|
||||||
|
|
||||||
for (i, s_i) in responses.iter().enumerate() {
|
let L_i = compute_L(h, mu_P, mu_C, s_i, *pk_i, adjusted_commitment_i);
|
||||||
let pk_i = ring[i % RING_SIZE];
|
let R_i = compute_R(h, mu_P, mu_C, s_i, *pk_i, I, D);
|
||||||
|
|
||||||
let adjusted_commitment_i = adjusted_commitment_ring[i % RING_SIZE];
|
dbg!(hex::encode(L_i.compress().as_bytes()));
|
||||||
|
dbg!(hex::encode(R_i.compress().as_bytes()));
|
||||||
|
|
||||||
dbg!(hex::encode(pk_i.compress().as_bytes()));
|
hash_to_scalar!(
|
||||||
dbg!(hex::encode(adjusted_commitment_i.compress().as_bytes()));
|
b"CLSAG_round"
|
||||||
|
|| ring
|
||||||
|
|| commitment_ring
|
||||||
|
|| pseudo_output_commitment
|
||||||
|
|| msg
|
||||||
|
|| L_i
|
||||||
|
|| R_i
|
||||||
|
)
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
let L_i = compute_L(h, mu_P, mu_C, *s_i, pk_i, adjusted_commitment_i);
|
h_0_computed == h_0
|
||||||
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!(
|
|
||||||
b"CLSAG_round"
|
|
||||||
|| ring
|
|
||||||
|| commitment_ring
|
|
||||||
|| pseudo_output_commitment
|
|
||||||
|| msg
|
|
||||||
|| L_i
|
|
||||||
|| R_i
|
|
||||||
);
|
|
||||||
|
|
||||||
dbg!(hex::encode(h.as_bytes()));
|
|
||||||
}
|
|
||||||
|
|
||||||
h == h_0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user