added basic tests around range_proof (#121)

Pass nonce in to range_proof (we need it for rewind_range_proof, at least for testing)
This commit is contained in:
AntiochP
2017-09-10 14:31:41 -04:00
committed by Ignotus Peverell
parent 6056c16cfa
commit 87cd0e5c58
5 changed files with 87 additions and 15 deletions
+2 -1
View File
@@ -458,7 +458,8 @@ impl Block {
let sig = try!(secp.sign(&msg, &skey));
let commit = secp.commit(REWARD, skey).unwrap();
//let switch_commit = secp.switch_commit(skey).unwrap();
let rproof = secp.range_proof(0, REWARD, skey, commit);
let nonce = secp.nonce();
let rproof = secp.range_proof(0, REWARD, skey, commit, nonce);
let output = Output {
features: COINBASE_OUTPUT,
+4 -2
View File
@@ -110,7 +110,8 @@ pub fn input_rand(value: u64) -> Box<Append> {
pub fn output(value: u64, blinding: SecretKey) -> Box<Append> {
Box::new(move |build, (tx, sum)| -> (Transaction, BlindSum) {
let commit = build.secp.commit(value, blinding).unwrap();
let rproof = build.secp.range_proof(0, value, blinding, commit);
let nonce = build.secp.nonce();
let rproof = build.secp.range_proof(0, value, blinding, commit, nonce);
(tx.with_output(Output {
features: DEFAULT_OUTPUT,
commit: commit,
@@ -127,7 +128,8 @@ pub fn output_rand(value: u64) -> Box<Append> {
Box::new(move |build, (tx, sum)| -> (Transaction, BlindSum) {
let blinding = SecretKey::new(&build.secp, &mut build.rng);
let commit = build.secp.commit(value, blinding).unwrap();
let rproof = build.secp.range_proof(0, value, blinding, commit);
let nonce = build.secp.nonce();
let rproof = build.secp.range_proof(0, value, blinding, commit, nonce);
(tx.with_output(Output {
features: DEFAULT_OUTPUT,
commit: commit,