updates
This commit is contained in:
parent
fb261a917b
commit
7cd78d391a
|
@ -1,7 +1,6 @@
|
|||
// commit_schemes.rs
|
||||
|
||||
use std::fmt;
|
||||
//use rand::prelude::*;
|
||||
use rand::{thread_rng, Rng};
|
||||
use bn::{Group, Fr, G1, G2};
|
||||
use clsigs;
|
||||
|
@ -10,9 +9,6 @@ use bincode::SizeLimit::Infinite;
|
|||
use bincode::rustc_serialize::encode;
|
||||
use sodiumoxide::crypto::hash::sha512;
|
||||
|
||||
// define some structures here
|
||||
|
||||
// define some structures here
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct PublicKey {
|
||||
g: G2,
|
||||
|
@ -131,13 +127,6 @@ pub fn setup(len: usize, pub_bases: Vec<G2>, h: G2) -> CSParams {
|
|||
let mut p: Vec<G2> = Vec::new();
|
||||
p.push(h);
|
||||
|
||||
//if pub_bases.is_none() {
|
||||
// for i in 1 .. len-1 {
|
||||
// p.push(G2::random(rng));
|
||||
// }
|
||||
// return CSParams { pub_bases: p };
|
||||
//}
|
||||
|
||||
let _p = pub_bases;
|
||||
for i in 0 .. _p.len() {
|
||||
p.push(_p[i]);
|
||||
|
@ -175,9 +164,7 @@ pub fn commit(csp: &CSParams, x: &Vec<Fr>, r: Fr) -> Commitment {
|
|||
}
|
||||
|
||||
pub fn decommit(csp: &CSParams, cm: &Commitment, x: &Vec<Fr>) -> bool {
|
||||
//let mut dc = (csp.h * cm.r);
|
||||
let l = x.len();
|
||||
//assert!(csp.pub_bases.len() == l);
|
||||
// pub_base[0] => h, x[0] => r
|
||||
// check that cm.r == x[0]
|
||||
// assert!(cm.r == x[0]);
|
||||
|
|
|
@ -900,7 +900,6 @@ pub mod bidirectional {
|
|||
let mut transcript = ProofTranscript::new(b"BOLT Range Proof");
|
||||
let value = updated_balance as u64;
|
||||
let val_blinding = Scalar::hash_from_bytes::<Sha512>(&w_com_bytes);
|
||||
//let val_blinding = Scalar::random(&mut osrng);
|
||||
let range_proof = RangeProof::prove_single(&pp.range_proof_gens, &mut transcript,
|
||||
&mut osrng, value, &val_blinding,
|
||||
pp.range_proof_bits).unwrap();
|
||||
|
@ -915,8 +914,6 @@ pub mod bidirectional {
|
|||
let bal_inc_fr = -convert_int_to_fr(balance_increment + channel.tx_fee);
|
||||
let inc_vec: Vec<Fr> = vec![r_inc, bal_inc_fr];
|
||||
let mut v_com = commit_scheme::commit(&cm_csp, &inc_vec, r_inc);
|
||||
//let tx_fee = cm_csp.pub_bases[1] * -convert_int_to_fr(channel.tx_fee);
|
||||
//v_com.c = v_com.c + tx_fee;
|
||||
let proof_vcom = clproto::bs_gen_nizk_proof(&inc_vec, &cm_csp.pub_bases, v_com.c);
|
||||
|
||||
// range proof that pay increment < payment max
|
||||
|
@ -1064,7 +1061,6 @@ pub mod bidirectional {
|
|||
return rt_w;
|
||||
}
|
||||
|
||||
// let's update the merchant's wallet balance now
|
||||
panic!("pay_by_merchant_phase1 - NIZK verification failed for new wallet commitment!");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue