Minor warning cleanup in core

Remove some unused import and add missing docs.
This commit is contained in:
Ignotus Peverell 2017-07-20 14:22:40 +00:00
parent 23816d1c2b
commit eb11b14cab
No known key found for this signature in database
GPG key ID: 99CD25F39F8F8211
6 changed files with 10 additions and 17 deletions

View file

@ -19,11 +19,8 @@
//! enough, consensus-relevant constants and short functions should be kept
//! here.
use std::cmp;
use std::fmt;
use bigint::{BigInt, Sign};
use core::target::Difficulty;
/// The block subsidy amount
@ -64,17 +61,21 @@ pub const CUT_THROUGH_HORIZON: u32 = 48 * 3600 / (BLOCK_TIME_SEC as u32);
pub const MAX_MSG_LEN: u64 = 20_000_000;
/// The minimum mining difficulty we'll allow
pub const MINIMUM_DIFFICULTY: u32 = 10;
/// Time window in blocks to calculate block time median
pub const MEDIAN_TIME_WINDOW: u32 = 11;
/// Number of blocks used to calculate difficulty adjustments
pub const DIFFICULTY_ADJUST_WINDOW: u32 = 23;
/// Average time span of the difficulty adjustment window
pub const BLOCK_TIME_WINDOW: i64 = (DIFFICULTY_ADJUST_WINDOW as i64) * BLOCK_TIME_SEC;
/// Maximum size time window used for difficutly adjustments
pub const UPPER_TIME_BOUND: i64 = BLOCK_TIME_WINDOW * 4 / 3;
/// Minimum size time window used for difficutly adjustments
pub const LOWER_TIME_BOUND: i64 = BLOCK_TIME_WINDOW * 5 / 6;
/// Error when computing the next difficulty adjustment.

View file

@ -17,7 +17,6 @@
use time;
use core;
use consensus::DEFAULT_SIZESHIFT;
use consensus::MINIMUM_DIFFICULTY;
use core::hash::Hashed;
use core::target::Difficulty;

View file

@ -18,7 +18,6 @@
//! miner will be much faster in almost every environment.
use std::collections::HashSet;
use std::collections::HashMap;
use std::cmp;
use crypto::digest::Digest;

View file

@ -24,17 +24,15 @@
mod siphash;
pub mod cuckoo;
use std::collections::HashMap;
use time;
use consensus::EASINESS;
use consensus::MINIMUM_DIFFICULTY;
use core::BlockHeader;
use core::hash::Hashed;
use core::Proof;
use core::target::Difficulty;
use pow::cuckoo::{Cuckoo, Miner, Error};
use pow::cuckoo::{Cuckoo, Error};
/// Should be implemented by anything providing mining services
@ -42,12 +40,11 @@ use pow::cuckoo::{Cuckoo, Miner, Error};
pub trait MiningWorker {
//This only sets parameters and does initialisation work now
fn new(ease: u32,
sizeshift: u32) -> Self;
/// This only sets parameters and does initialisation work now
fn new(ease: u32, sizeshift: u32) -> Self;
//Actually perform a mining attempt on the given input and
//return a proof if found
/// Actually perform a mining attempt on the given input and
/// return a proof if found
fn mine(&mut self, header: &[u8]) -> Result<Proof, Error>;
}
@ -71,7 +68,6 @@ pub fn pow20<T: MiningWorker>(miner:&mut T, bh: &mut BlockHeader, diff: Difficul
/// Runs a proof of work computation over the provided block using the provided Mining Worker,
/// until the required difficulty target is reached. May take a while for a low target...
pub fn pow_size<T: MiningWorker>(miner:&mut T, bh: &mut BlockHeader,
diff: Difficulty, sizeshift: u32) -> Result<(), Error> {
let start_nonce = bh.nonce;

View file

@ -19,7 +19,6 @@ extern crate grin_chain as chain;
extern crate grin_api as api;
extern crate grin_wallet as wallet;
extern crate secp256k1zkp as secp;
extern crate tiny_keccak;
extern crate env_logger;
extern crate futures;

View file

@ -14,6 +14,5 @@ rocksdb = "^0.6.0"
## https://github.com/facebook/rocksdb/commit/816c1e30ca73615c75fc208ddcc4b05012b30951
## And swap the dependency for the one below
#rocksdb = { path = "../../rust-rocksdb" }
tiny-keccak = "1.1"
grin_core = { path = "../core" }