Various comment and dead wood cleanup

This commit is contained in:
Ignotus Peverell 2017-04-20 11:30:17 -07:00
parent 4e36c63cbb
commit e4ca924b47
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
3 changed files with 5 additions and 9 deletions
core/src/core
secp256k1zkp/src

View file

@ -31,7 +31,6 @@ use secp::key::SecretKey;
use rand::os::OsRng;
use core::{Transaction, Input, Output, DEFAULT_OUTPUT};
use core::Committed;
/// Context information available to transaction combinators.
pub struct Context {
@ -174,7 +173,6 @@ pub fn transaction(elems: Vec<Box<Append>>) -> Result<(Transaction, SecretKey),
|acc, elem| elem(&mut ctx, acc));
let blind_sum = sum.sum(&ctx.secp)?;
let pubkey = secp::key::PublicKey::from_secret_key(&ctx.secp, &blind_sum)?;
let msg = secp::Message::from_slice(&u64_to_32bytes(tx.fee))?;
let sig = ctx.secp.sign(&msg, &blind_sum)?;
tx.excess_sig = sig.serialize_der(&ctx.secp);

View file

@ -17,7 +17,6 @@
//! Direct bindings to the underlying C library functions. These should
//! not be needed for most users.
use std::mem;
use std::hash;
use libc::{c_int, c_uchar, c_uint, c_void, size_t, int64_t, uint64_t};

View file

@ -16,7 +16,6 @@
//! # Pedersen commitments and related range proofs
use std::mem;
use std::convert;
use ContextFlag;
use Error;
@ -25,7 +24,7 @@ use Secp256k1;
use constants;
use ffi;
use key;
use key::{SecretKey, PublicKey};
use key::SecretKey;
use rand::{Rng, OsRng};
/// A Pedersen commitment
@ -43,10 +42,6 @@ impl Commitment {
pub fn to_pubkey(&self, secp: &Secp256k1) -> Result<key::PublicKey, Error> {
key::PublicKey::from_slice(secp, &self.0)
}
/// Underlying data
pub fn bytes(&self) -> &[u8] {
&self.0
}
}
/// A range proof. Typically much larger in memory that the above (~5k).
@ -83,9 +78,11 @@ impl AsRef<[u8]> for RangeProof {
}
impl RangeProof {
/// The range proof as a byte slice.
pub fn bytes(&self) -> &[u8] {
&self.proof[..self.plen as usize]
}
/// Length of the range proof in bytes.
pub fn len(&self) -> usize {
self.plen
}
@ -327,6 +324,8 @@ impl Secp256k1 {
}
}
/// General information extracted from a range proof. Does not provide any
/// information about the value or the message (see rewind).
pub fn range_proof_info(&self, proof: RangeProof) -> ProofInfo {
let mut exp: i32 = 0;
let mut mantissa: i32 = 0;