Merge pull request #889 from ethcore/clippy
Bumping clippy and fixing warnings
This commit is contained in:
commit
ca17644289
20
Cargo.lock
generated
20
Cargo.lock
generated
@ -2,7 +2,7 @@
|
|||||||
name = "parity"
|
name = "parity"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.61 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ctrlc 1.1.1 (git+https://github.com/tomusdrw/rust-ctrlc.git)",
|
"ctrlc 1.1.1 (git+https://github.com/tomusdrw/rust-ctrlc.git)",
|
||||||
"daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"daemonize 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"docopt 0.6.78 (registry+https://github.com/rust-lang/crates.io-index)",
|
"docopt 0.6.78 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -97,9 +97,10 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clippy"
|
name = "clippy"
|
||||||
version = "0.0.54"
|
version = "0.0.61"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"quine-mc_cluskey 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex-syntax 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -211,7 +212,7 @@ dependencies = [
|
|||||||
name = "ethcore"
|
name = "ethcore"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.61 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.1.0",
|
"ethash 1.1.0",
|
||||||
@ -238,7 +239,7 @@ dependencies = [
|
|||||||
name = "ethcore-rpc"
|
name = "ethcore-rpc"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.61 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.1.0",
|
"ethash 1.1.0",
|
||||||
"ethcore 1.1.0",
|
"ethcore 1.1.0",
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.1.0",
|
||||||
@ -262,7 +263,7 @@ dependencies = [
|
|||||||
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bigint 0.1.0",
|
"bigint 0.1.0",
|
||||||
"chrono 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.61 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"crossbeam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"elastic-array 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -306,7 +307,7 @@ dependencies = [
|
|||||||
name = "ethminer"
|
name = "ethminer"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.61 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.1.0",
|
"ethcore 1.1.0",
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.1.0",
|
||||||
@ -320,7 +321,7 @@ dependencies = [
|
|||||||
name = "ethsync"
|
name = "ethsync"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.54 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clippy 0.0.61 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.1.0",
|
"ethcore 1.1.0",
|
||||||
"ethcore-util 1.1.0",
|
"ethcore-util 1.1.0",
|
||||||
@ -695,6 +696,11 @@ dependencies = [
|
|||||||
"syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quine-mc_cluskey"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.3.14"
|
version = "0.3.14"
|
||||||
|
@ -21,7 +21,7 @@ daemonize = "0.2"
|
|||||||
num_cpus = "0.2"
|
num_cpus = "0.2"
|
||||||
number_prefix = "0.2"
|
number_prefix = "0.2"
|
||||||
rpassword = "0.1"
|
rpassword = "0.1"
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
ethcore = { path = "ethcore" }
|
ethcore = { path = "ethcore" }
|
||||||
ethcore-util = { path = "util" }
|
ethcore-util = { path = "util" }
|
||||||
ethsync = { path = "sync" }
|
ethsync = { path = "sync" }
|
||||||
|
@ -17,7 +17,7 @@ ethcore-util = { path = "../util" }
|
|||||||
evmjit = { path = "../evmjit", optional = true }
|
evmjit = { path = "../evmjit", optional = true }
|
||||||
ethash = { path = "../ethash" }
|
ethash = { path = "../ethash" }
|
||||||
num_cpus = "0.2"
|
num_cpus = "0.2"
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
crossbeam = "0.1.5"
|
crossbeam = "0.1.5"
|
||||||
lazy_static = "0.1"
|
lazy_static = "0.1"
|
||||||
ethcore-devtools = { path = "../devtools" }
|
ethcore-devtools = { path = "../devtools" }
|
||||||
|
@ -138,7 +138,7 @@ impl Account {
|
|||||||
/// get someone who knows to call `note_code`.
|
/// get someone who knows to call `note_code`.
|
||||||
pub fn code(&self) -> Option<&[u8]> {
|
pub fn code(&self) -> Option<&[u8]> {
|
||||||
match self.code_hash {
|
match self.code_hash {
|
||||||
Some(SHA3_EMPTY) | None if self.code_cache.is_empty() => Some(&self.code_cache),
|
Some(c) if c == SHA3_EMPTY && self.code_cache.is_empty() => Some(&self.code_cache),
|
||||||
Some(_) if !self.code_cache.is_empty() => Some(&self.code_cache),
|
Some(_) if !self.code_cache.is_empty() => Some(&self.code_cache),
|
||||||
None => Some(&self.code_cache),
|
None => Some(&self.code_cache),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
@ -154,7 +154,7 @@ impl ExecutedBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for a object that is_a `ExecutedBlock`.
|
/// Trait for a object that is a `ExecutedBlock`.
|
||||||
pub trait IsBlock {
|
pub trait IsBlock {
|
||||||
/// Get the block associated with this object.
|
/// Get the block associated with this object.
|
||||||
fn block(&self) -> &ExecutedBlock;
|
fn block(&self) -> &ExecutedBlock;
|
||||||
@ -192,7 +192,7 @@ pub struct OpenBlock<'x> {
|
|||||||
last_hashes: LastHashes,
|
last_hashes: LastHashes,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Just like OpenBlock, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
|
/// Just like `OpenBlock`, except that we've applied `Engine::on_close_block`, finished up the non-seal header fields,
|
||||||
/// and collected the uncles.
|
/// and collected the uncles.
|
||||||
///
|
///
|
||||||
/// There is no function available to push a transaction.
|
/// There is no function available to push a transaction.
|
||||||
@ -204,7 +204,7 @@ pub struct ClosedBlock {
|
|||||||
unclosed_state: State,
|
unclosed_state: State,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Just like ClosedBlock except that we can't reopen it and it's faster.
|
/// Just like `ClosedBlock` except that we can't reopen it and it's faster.
|
||||||
///
|
///
|
||||||
/// We actually store the post-`Engine::on_close_block` state, unlike in `ClosedBlock` where it's the pre.
|
/// We actually store the post-`Engine::on_close_block` state, unlike in `ClosedBlock` where it's the pre.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -216,14 +216,15 @@ pub struct LockedBlock {
|
|||||||
|
|
||||||
/// A block that has a valid seal.
|
/// A block that has a valid seal.
|
||||||
///
|
///
|
||||||
/// The block's header has valid seal arguments. The block cannot be reversed into a ClosedBlock or OpenBlock.
|
/// The block's header has valid seal arguments. The block cannot be reversed into a `ClosedBlock` or `OpenBlock`.
|
||||||
pub struct SealedBlock {
|
pub struct SealedBlock {
|
||||||
block: ExecutedBlock,
|
block: ExecutedBlock,
|
||||||
uncle_bytes: Bytes,
|
uncle_bytes: Bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'x> OpenBlock<'x> {
|
impl<'x> OpenBlock<'x> {
|
||||||
/// Create a new OpenBlock ready for transaction pushing.
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
|
/// Create a new `OpenBlock` ready for transaction pushing.
|
||||||
pub fn new(engine: &'x Engine, tracing: bool, db: Box<JournalDB>, parent: &Header, last_hashes: LastHashes, author: Address, gas_floor_target: U256, extra_data: Bytes) -> Self {
|
pub fn new(engine: &'x Engine, tracing: bool, db: Box<JournalDB>, parent: &Header, last_hashes: LastHashes, author: Address, gas_floor_target: U256, extra_data: Bytes) -> Self {
|
||||||
let mut r = OpenBlock {
|
let mut r = OpenBlock {
|
||||||
block: ExecutedBlock::new(State::from_existing(db, parent.state_root().clone(), engine.account_start_nonce()), tracing),
|
block: ExecutedBlock::new(State::from_existing(db, parent.state_root().clone(), engine.account_start_nonce()), tracing),
|
||||||
@ -319,7 +320,7 @@ impl<'x> OpenBlock<'x> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Turn this into a `ClosedBlock`. A BlockChain must be provided in order to figure out the uncles.
|
/// Turn this into a `ClosedBlock`. A `BlockChain` must be provided in order to figure out the uncles.
|
||||||
pub fn close(self) -> ClosedBlock {
|
pub fn close(self) -> ClosedBlock {
|
||||||
let mut s = self;
|
let mut s = self;
|
||||||
|
|
||||||
@ -454,6 +455,7 @@ impl IsBlock for SealedBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Enact the block given by block header, transactions and uncles
|
/// Enact the block given by block header, transactions and uncles
|
||||||
|
#[cfg_attr(feature="dev", allow(too_many_arguments))]
|
||||||
pub fn enact(header: &Header, transactions: &[SignedTransaction], uncles: &[Header], engine: &Engine, tracing: bool, db: Box<JournalDB>, parent: &Header, last_hashes: LastHashes) -> Result<LockedBlock, Error> {
|
pub fn enact(header: &Header, transactions: &[SignedTransaction], uncles: &[Header], engine: &Engine, tracing: bool, db: Box<JournalDB>, parent: &Header, last_hashes: LastHashes) -> Result<LockedBlock, Error> {
|
||||||
{
|
{
|
||||||
if ::log::max_log_level() >= ::log::LogLevel::Trace {
|
if ::log::max_log_level() >= ::log::LogLevel::Trace {
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! A queue of blocks. Sits between network or other I/O and the BlockChain.
|
//! A queue of blocks. Sits between network or other I/O and the `BlockChain`.
|
||||||
//! Sorts them ready for blockchain insertion.
|
//! Sorts them ready for blockchain insertion.
|
||||||
use std::thread::{JoinHandle, self};
|
use std::thread::{JoinHandle, self};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
|
use std::sync::atomic::{AtomicBool, Ordering as AtomicOrdering};
|
||||||
@ -89,7 +89,7 @@ impl BlockQueueInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A queue of blocks. Sits between network or other I/O and the BlockChain.
|
/// A queue of blocks. Sits between network or other I/O and the `BlockChain`.
|
||||||
/// Sorts them ready for blockchain insertion.
|
/// Sorts them ready for blockchain insertion.
|
||||||
pub struct BlockQueue {
|
pub struct BlockQueue {
|
||||||
panic_handler: Arc<PanicHandler>,
|
panic_handler: Arc<PanicHandler>,
|
||||||
|
@ -427,6 +427,7 @@ impl BlockChain {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(feature="dev", allow(similar_names))]
|
||||||
/// Inserts the block into backing cache database.
|
/// Inserts the block into backing cache database.
|
||||||
/// Expects the block to be valid and already verified.
|
/// Expects the block to be valid and already verified.
|
||||||
/// If the block is already known, does nothing.
|
/// If the block is already known, does nothing.
|
||||||
@ -855,6 +856,7 @@ impl BlockChain {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![cfg_attr(feature="dev", allow(similar_names))]
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use rustc_serialize::hex::FromHex;
|
use rustc_serialize::hex::FromHex;
|
||||||
use util::hash::*;
|
use util::hash::*;
|
||||||
|
@ -87,6 +87,7 @@ impl Indexer {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
#![cfg_attr(feature="dev", allow(similar_names))]
|
||||||
use chainfilter::BloomIndex;
|
use chainfilter::BloomIndex;
|
||||||
use chainfilter::indexer::Indexer;
|
use chainfilter::indexer::Indexer;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ use chainfilter::{BloomIndex, FilterDataSource, ChainFilter};
|
|||||||
|
|
||||||
/// In memory cache for blooms.
|
/// In memory cache for blooms.
|
||||||
///
|
///
|
||||||
/// Stores all blooms in HashMap, which indexes them by `BloomIndex`.
|
/// Stores all blooms in `HashMap`, which indexes them by `BloomIndex`.
|
||||||
pub struct MemoryCache {
|
pub struct MemoryCache {
|
||||||
blooms: HashMap<BloomIndex, H2048>,
|
blooms: HashMap<BloomIndex, H2048>,
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ pub enum Error {
|
|||||||
|
|
||||||
/// Evm result.
|
/// Evm result.
|
||||||
///
|
///
|
||||||
/// Returns gas_left if execution is successful, otherwise error.
|
/// Returns `gas_left` if execution is successful, otherwise error.
|
||||||
pub type Result = result::Result<U256, Error>;
|
pub type Result = result::Result<U256, Error>;
|
||||||
|
|
||||||
/// Evm interface.
|
/// Evm interface.
|
||||||
|
@ -55,7 +55,7 @@ pub fn verify_block_basic(header: &Header, bytes: &[u8], engine: &Engine) -> Res
|
|||||||
|
|
||||||
/// Phase 2 verification. Perform costly checks such as transaction signatures and block nonce for ethash.
|
/// Phase 2 verification. Perform costly checks such as transaction signatures and block nonce for ethash.
|
||||||
/// Still operates on a individual block
|
/// Still operates on a individual block
|
||||||
/// Returns a PreverifiedBlock structure populated with transactions
|
/// Returns a `PreverifiedBlock` structure populated with transactions
|
||||||
pub fn verify_block_unordered(header: Header, bytes: Bytes, engine: &Engine) -> Result<PreverifiedBlock, Error> {
|
pub fn verify_block_unordered(header: Header, bytes: Bytes, engine: &Engine) -> Result<PreverifiedBlock, Error> {
|
||||||
try!(engine.verify_block_unordered(&header, Some(&bytes)));
|
try!(engine.verify_block_unordered(&header, Some(&bytes)));
|
||||||
for u in Rlp::new(&bytes).at(2).iter().map(|rlp| rlp.as_val::<Header>()) {
|
for u in Rlp::new(&bytes).at(2).iter().map(|rlp| rlp.as_val::<Header>()) {
|
||||||
@ -331,6 +331,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(feature="dev", allow(similar_names))]
|
||||||
fn test_verify_block() {
|
fn test_verify_block() {
|
||||||
// Test against morden
|
// Test against morden
|
||||||
let mut good = Header::new();
|
let mut good = Header::new();
|
||||||
|
@ -10,7 +10,7 @@ rustc-serialize = "0.3"
|
|||||||
serde = "0.7.0"
|
serde = "0.7.0"
|
||||||
serde_json = "0.7.0"
|
serde_json = "0.7.0"
|
||||||
serde_macros = { version = "0.7.0", optional = true }
|
serde_macros = { version = "0.7.0", optional = true }
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
serde_codegen = { version = "0.7.0", optional = true }
|
serde_codegen = { version = "0.7.0", optional = true }
|
||||||
|
@ -17,7 +17,7 @@ log = "0.3"
|
|||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
rayon = "0.3.1"
|
rayon = "0.3.1"
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
@ -94,6 +94,7 @@ impl Miner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Prepares new block for sealing including top transactions from queue.
|
/// Prepares new block for sealing including top transactions from queue.
|
||||||
|
#[cfg_attr(feature="dev", allow(match_same_arms))]
|
||||||
fn prepare_sealing(&self, chain: &BlockChainClient) {
|
fn prepare_sealing(&self, chain: &BlockChainClient) {
|
||||||
trace!(target: "miner", "prepare_sealing: entering");
|
trace!(target: "miner", "prepare_sealing: entering");
|
||||||
let transactions = self.transaction_queue.lock().unwrap().top_transactions();
|
let transactions = self.transaction_queue.lock().unwrap().top_transactions();
|
||||||
@ -164,7 +165,7 @@ impl Miner {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
if let Some(block) = b {
|
if let Some(block) = b {
|
||||||
if sealing_work.peek_last_ref().map(|pb| pb.block().fields().header.hash() != block.block().fields().header.hash()).unwrap_or(true) {
|
if sealing_work.peek_last_ref().map_or(true, |pb| pb.block().fields().header.hash() != block.block().fields().header.hash()) {
|
||||||
trace!(target: "miner", "Pushing a new, refreshed or borrowed pending {}...", block.block().fields().header.hash());
|
trace!(target: "miner", "Pushing a new, refreshed or borrowed pending {}...", block.block().fields().header.hash());
|
||||||
sealing_work.push(block);
|
sealing_work.push(block);
|
||||||
}
|
}
|
||||||
@ -200,7 +201,7 @@ impl MinerService for Miner {
|
|||||||
|
|
||||||
fn sensible_gas_price(&self) -> U256 {
|
fn sensible_gas_price(&self) -> U256 {
|
||||||
// 10% above our minimum.
|
// 10% above our minimum.
|
||||||
self.transaction_queue.lock().unwrap().minimal_gas_price().clone() * x!(110) / x!(100)
|
*self.transaction_queue.lock().unwrap().minimal_gas_price() * x!(110) / x!(100)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn author(&self) -> Address {
|
fn author(&self) -> Address {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
//! Transaction Queue
|
//! Transaction Queue
|
||||||
//!
|
//!
|
||||||
//! TransactionQueue keeps track of all transactions seen by the node (received from other peers) and own transactions
|
//! `TransactionQueue` keeps track of all transactions seen by the node (received from other peers) and own transactions
|
||||||
//! and orders them by priority. Top priority transactions are those with low nonce height (difference between
|
//! and orders them by priority. Top priority transactions are those with low nonce height (difference between
|
||||||
//! transaction's nonce and next nonce expected from this sender). If nonces are equal transaction's gas price is used
|
//! transaction's nonce and next nonce expected from this sender). If nonces are equal transaction's gas price is used
|
||||||
//! for comparison (higher gas price = higher priority).
|
//! for comparison (higher gas price = higher priority).
|
||||||
@ -179,7 +179,7 @@ impl VerifiedTransaction {
|
|||||||
|
|
||||||
/// Holds transactions accessible by (address, nonce) and by priority
|
/// Holds transactions accessible by (address, nonce) and by priority
|
||||||
///
|
///
|
||||||
/// TransactionSet keeps number of entries below limit, but it doesn't
|
/// `TransactionSet` keeps number of entries below limit, but it doesn't
|
||||||
/// automatically happen during `insert/remove` operations.
|
/// automatically happen during `insert/remove` operations.
|
||||||
/// You have to call `enforce_limit` to remove lowest priority transactions from set.
|
/// You have to call `enforce_limit` to remove lowest priority transactions from set.
|
||||||
struct TransactionSet {
|
struct TransactionSet {
|
||||||
@ -262,7 +262,7 @@ pub struct AccountDetails {
|
|||||||
/// Transactions with `gas > (gas_limit + gas_limit * Factor(in percents))` are not imported to the queue.
|
/// Transactions with `gas > (gas_limit + gas_limit * Factor(in percents))` are not imported to the queue.
|
||||||
const GAS_LIMIT_HYSTERESIS: usize = 10; // %
|
const GAS_LIMIT_HYSTERESIS: usize = 10; // %
|
||||||
|
|
||||||
/// TransactionQueue implementation
|
/// `TransactionQueue` implementation
|
||||||
pub struct TransactionQueue {
|
pub struct TransactionQueue {
|
||||||
/// Gas Price threshold for transactions that can be imported to this queue (defaults to 0)
|
/// Gas Price threshold for transactions that can be imported to this queue (defaults to 0)
|
||||||
minimal_gas_price: U256,
|
minimal_gas_price: U256,
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#![warn(missing_docs)]
|
#![warn(missing_docs)]
|
||||||
#![cfg_attr(feature="dev", feature(plugin))]
|
#![cfg_attr(feature="dev", feature(plugin))]
|
||||||
#![cfg_attr(feature="dev", plugin(clippy))]
|
#![cfg_attr(feature="dev", plugin(clippy))]
|
||||||
|
#![cfg_attr(feature="dev", allow(useless_format))]
|
||||||
extern crate docopt;
|
extern crate docopt;
|
||||||
extern crate num_cpus;
|
extern crate num_cpus;
|
||||||
extern crate rustc_serialize;
|
extern crate rustc_serialize;
|
||||||
@ -361,9 +362,9 @@ impl Configuration {
|
|||||||
die!("{}: Invalid basic transaction price given in USD. Must be a decimal number.", self.args.flag_usd_per_tx)
|
die!("{}: Invalid basic transaction price given in USD. Must be a decimal number.", self.args.flag_usd_per_tx)
|
||||||
});
|
});
|
||||||
let usd_per_eth = match self.args.flag_usd_per_eth.as_str() {
|
let usd_per_eth = match self.args.flag_usd_per_eth.as_str() {
|
||||||
"etherscan" => price_info::PriceInfo::get().map(|x| x.ethusd).unwrap_or_else(|| {
|
"etherscan" => price_info::PriceInfo::get().map_or_else(|| {
|
||||||
die!("Unable to retrieve USD value of ETH from etherscan. Rerun with a different value for --usd-per-eth.")
|
die!("Unable to retrieve USD value of ETH from etherscan. Rerun with a different value for --usd-per-eth.")
|
||||||
}),
|
}, |x| x.ethusd),
|
||||||
x => FromStr::from_str(x).unwrap_or_else(|_| die!("{}: Invalid ether price given in USD. Must be a decimal number.", x))
|
x => FromStr::from_str(x).unwrap_or_else(|_| die!("{}: Invalid ether price given in USD. Must be a decimal number.", x))
|
||||||
};
|
};
|
||||||
let wei_per_usd: f32 = 1.0e18 / usd_per_eth;
|
let wei_per_usd: f32 = 1.0e18 / usd_per_eth;
|
||||||
@ -421,7 +422,6 @@ impl Configuration {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature="dev", allow(useless_format))]
|
|
||||||
fn net_addresses(&self) -> (Option<SocketAddr>, Option<SocketAddr>) {
|
fn net_addresses(&self) -> (Option<SocketAddr>, Option<SocketAddr>) {
|
||||||
let listen_address = Some(SocketAddr::new(IpAddr::from_str("0.0.0.0").unwrap(), self.args.flag_port));
|
let listen_address = Some(SocketAddr::new(IpAddr::from_str("0.0.0.0").unwrap(), self.args.flag_port));
|
||||||
let public_address = if self.args.flag_nat.starts_with("extip:") {
|
let public_address = if self.args.flag_nat.starts_with("extip:") {
|
||||||
@ -450,7 +450,6 @@ impl Configuration {
|
|||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature="dev", allow(useless_format))]
|
|
||||||
fn client_config(&self) -> ClientConfig {
|
fn client_config(&self) -> ClientConfig {
|
||||||
let mut client_config = ClientConfig::default();
|
let mut client_config = ClientConfig::default();
|
||||||
match self.args.flag_cache {
|
match self.args.flag_cache {
|
||||||
@ -551,7 +550,6 @@ impl Configuration {
|
|||||||
account_service
|
account_service
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(feature="dev", allow(useless_format))]
|
|
||||||
fn execute_client(&self) {
|
fn execute_client(&self) {
|
||||||
// Setup panic handler
|
// Setup panic handler
|
||||||
let panic_handler = PanicHandler::new_in_arc();
|
let panic_handler = PanicHandler::new_in_arc();
|
||||||
|
@ -19,8 +19,8 @@ impl PriceInfo {
|
|||||||
.and_then(|mut s| s.read_to_string(&mut body).ok())
|
.and_then(|mut s| s.read_to_string(&mut body).ok())
|
||||||
.and_then(|_| Json::from_str(&body).ok())
|
.and_then(|_| Json::from_str(&body).ok())
|
||||||
.and_then(|json| json.find_path(&["result", "ethusd"])
|
.and_then(|json| json.find_path(&["result", "ethusd"])
|
||||||
.and_then(|obj| match obj {
|
.and_then(|obj| match *obj {
|
||||||
&Json::String(ref s) => Some(PriceInfo {
|
Json::String(ref s) => Some(PriceInfo {
|
||||||
ethusd: FromStr::from_str(&s).unwrap()
|
ethusd: FromStr::from_str(&s).unwrap()
|
||||||
}),
|
}),
|
||||||
_ => None
|
_ => None
|
||||||
|
@ -22,7 +22,7 @@ ethminer = { path = "../miner" }
|
|||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
transient-hashmap = "0.1"
|
transient-hashmap = "0.1"
|
||||||
serde_macros = { version = "0.7.0", optional = true }
|
serde_macros = { version = "0.7.0", optional = true }
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
serde_codegen = { version = "0.7.0", optional = true }
|
serde_codegen = { version = "0.7.0", optional = true }
|
||||||
|
@ -10,7 +10,7 @@ authors = ["Ethcore <admin@ethcore.io"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
ethcore-util = { path = "../util" }
|
ethcore-util = { path = "../util" }
|
||||||
ethcore = { path = "../ethcore" }
|
ethcore = { path = "../ethcore" }
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
ethminer = { path = "../miner" }
|
ethminer = { path = "../miner" }
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
///
|
///
|
||||||
/// BlockChain synchronization strategy.
|
/// `BlockChain` synchronization strategy.
|
||||||
/// Syncs to peers and keeps up to date.
|
/// Syncs to peers and keeps up to date.
|
||||||
/// This implementation uses ethereum protocol v63
|
/// This implementation uses ethereum protocol v63
|
||||||
///
|
///
|
||||||
@ -127,7 +127,7 @@ pub struct SyncStatus {
|
|||||||
pub protocol_version: u8,
|
pub protocol_version: u8,
|
||||||
/// The underlying p2p network version.
|
/// The underlying p2p network version.
|
||||||
pub network_id: U256,
|
pub network_id: U256,
|
||||||
/// BlockChain height for the moment the sync started.
|
/// `BlockChain` height for the moment the sync started.
|
||||||
pub start_block_number: BlockNumber,
|
pub start_block_number: BlockNumber,
|
||||||
/// Last fully downloaded and imported block number (if any).
|
/// Last fully downloaded and imported block number (if any).
|
||||||
pub last_imported_block_number: Option<BlockNumber>,
|
pub last_imported_block_number: Option<BlockNumber>,
|
||||||
@ -1292,12 +1292,12 @@ impl ChainSync {
|
|||||||
fn propagate_new_transactions(&mut self, io: &mut SyncIo) -> usize {
|
fn propagate_new_transactions(&mut self, io: &mut SyncIo) -> usize {
|
||||||
|
|
||||||
// Early out of nobody to send to.
|
// Early out of nobody to send to.
|
||||||
if self.peers.len() == 0 {
|
if self.peers.is_empty() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut packet = RlpStream::new_list(self.transactions_to_send.len());
|
let mut packet = RlpStream::new_list(self.transactions_to_send.len());
|
||||||
for tx in self.transactions_to_send.iter() {
|
for tx in &self.transactions_to_send {
|
||||||
packet.append_raw(tx, 1);
|
packet.append_raw(tx, 1);
|
||||||
}
|
}
|
||||||
self.transactions_to_send.clear();
|
self.transactions_to_send.clear();
|
||||||
@ -1312,7 +1312,7 @@ impl ChainSync {
|
|||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
// taking at max of MAX_PEERS_PROPAGATION
|
// taking at max of MAX_PEERS_PROPAGATION
|
||||||
lucky_peers.iter().map(|&id| id.clone()).take(min(lucky_peers.len(), MAX_PEERS_PROPAGATION)).collect::<Vec<PeerId>>()
|
lucky_peers.iter().cloned().take(min(lucky_peers.len(), MAX_PEERS_PROPAGATION)).collect::<Vec<PeerId>>()
|
||||||
};
|
};
|
||||||
|
|
||||||
let sent = lucky_peers.len();
|
let sent = lucky_peers.len();
|
||||||
@ -1701,8 +1701,8 @@ mod tests {
|
|||||||
let retracted_blocks = vec![client.block_hash_delta_minus(1)];
|
let retracted_blocks = vec![client.block_hash_delta_minus(1)];
|
||||||
|
|
||||||
// Add some balance to clients
|
// Add some balance to clients
|
||||||
for h in vec![good_blocks[0], retracted_blocks[0]] {
|
for h in &[good_blocks[0], retracted_blocks[0]] {
|
||||||
let block = client.block(BlockId::Hash(h)).unwrap();
|
let block = client.block(BlockId::Hash(*h)).unwrap();
|
||||||
let view = BlockView::new(&block);
|
let view = BlockView::new(&block);
|
||||||
client.set_balance(view.transactions()[0].sender().unwrap(), U256::from(1_000_000_000));
|
client.set_balance(view.transactions()[0].sender().unwrap(), U256::from(1_000_000_000));
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ crossbeam = "0.2"
|
|||||||
slab = "0.1"
|
slab = "0.1"
|
||||||
sha3 = { path = "sha3" }
|
sha3 = { path = "sha3" }
|
||||||
serde = "0.7.0"
|
serde = "0.7.0"
|
||||||
clippy = { version = "0.0.54", optional = true }
|
clippy = { version = "0.0.61", optional = true}
|
||||||
json-tests = { path = "json-tests" }
|
json-tests = { path = "json-tests" }
|
||||||
igd = "0.4.2"
|
igd = "0.4.2"
|
||||||
ethcore-devtools = { path = "../devtools" }
|
ethcore-devtools = { path = "../devtools" }
|
||||||
|
@ -157,6 +157,7 @@ impl KeyPair {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// EC functions
|
/// EC functions
|
||||||
|
#[cfg_attr(feature="dev", allow(similar_names))]
|
||||||
pub mod ec {
|
pub mod ec {
|
||||||
use numbers::*;
|
use numbers::*;
|
||||||
use standard::*;
|
use standard::*;
|
||||||
@ -193,6 +194,7 @@ pub mod ec {
|
|||||||
}
|
}
|
||||||
Ok(signature)
|
Ok(signature)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Verify signature.
|
/// Verify signature.
|
||||||
pub fn verify(public: &Public, signature: &Signature, message: &H256) -> Result<bool, CryptoError> {
|
pub fn verify(public: &Public, signature: &Signature, message: &H256) -> Result<bool, CryptoError> {
|
||||||
use secp256k1::*;
|
use secp256k1::*;
|
||||||
@ -233,6 +235,7 @@ pub mod ec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ECDH functions
|
/// ECDH functions
|
||||||
|
#[cfg_attr(feature="dev", allow(similar_names))]
|
||||||
pub mod ecdh {
|
pub mod ecdh {
|
||||||
use crypto::*;
|
use crypto::*;
|
||||||
use crypto::{self};
|
use crypto::{self};
|
||||||
@ -254,6 +257,7 @@ pub mod ecdh {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ECIES function
|
/// ECIES function
|
||||||
|
#[cfg_attr(feature="dev", allow(similar_names))]
|
||||||
pub mod ecies {
|
pub mod ecies {
|
||||||
use hash::*;
|
use hash::*;
|
||||||
use bytes::*;
|
use bytes::*;
|
||||||
|
@ -392,7 +392,7 @@ macro_rules! impl_hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BitOr on references
|
/// `BitOr` on references
|
||||||
impl<'a> BitOr for &'a $from {
|
impl<'a> BitOr for &'a $from {
|
||||||
type Output = $from;
|
type Output = $from;
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ macro_rules! impl_hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Moving BitOr
|
/// Moving `BitOr`
|
||||||
impl BitOr for $from {
|
impl BitOr for $from {
|
||||||
type Output = $from;
|
type Output = $from;
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ macro_rules! impl_hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BitAnd on references
|
/// `BitAnd` on references
|
||||||
impl <'a> BitAnd for &'a $from {
|
impl <'a> BitAnd for &'a $from {
|
||||||
type Output = $from;
|
type Output = $from;
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ macro_rules! impl_hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Moving BitAnd
|
/// Moving `BitAnd`
|
||||||
impl BitAnd for $from {
|
impl BitAnd for $from {
|
||||||
type Output = $from;
|
type Output = $from;
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ macro_rules! impl_hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// BitXor on references
|
/// `BitXor` on references
|
||||||
impl <'a> BitXor for &'a $from {
|
impl <'a> BitXor for &'a $from {
|
||||||
type Output = $from;
|
type Output = $from;
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ macro_rules! impl_hash {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Moving BitXor
|
/// Moving `BitXor`
|
||||||
impl BitXor for $from {
|
impl BitXor for $from {
|
||||||
type Output = $from;
|
type Output = $from;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Disk-backed HashDB implementation.
|
//! Disk-backed `HashDB` implementation.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
@ -25,11 +25,11 @@ use kvdb::{Database, DBTransaction, DatabaseConfig};
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
/// Implementation of the HashDB trait for a disk-backed database with a memory overlay
|
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
|
||||||
/// and latent-removal semantics.
|
/// and latent-removal semantics.
|
||||||
///
|
///
|
||||||
/// Like OverlayDB, there is a memory overlay; `commit()` must be called in order to
|
/// Like `OverlayDB`, there is a memory overlay; `commit()` must be called in order to
|
||||||
/// write operations out to disk. Unlike OverlayDB, `remove()` operations do not take effect
|
/// write operations out to disk. Unlike `OverlayDB`, `remove()` operations do not take effect
|
||||||
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
||||||
/// the removals actually take effect.
|
/// the removals actually take effect.
|
||||||
pub struct ArchiveDB {
|
pub struct ArchiveDB {
|
||||||
@ -176,6 +176,7 @@ impl JournalDB for ArchiveDB {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
#![cfg_attr(feature="dev", allow(similar_names))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Disk-backed HashDB implementation.
|
//! Disk-backed `HashDB` implementation.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
@ -53,11 +53,11 @@ enum RemoveFrom {
|
|||||||
Archive,
|
Archive,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of the HashDB trait for a disk-backed database with a memory overlay
|
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
|
||||||
/// and latent-removal semantics.
|
/// and latent-removal semantics.
|
||||||
///
|
///
|
||||||
/// Like OverlayDB, there is a memory overlay; `commit()` must be called in order to
|
/// Like `OverlayDB`, there is a memory overlay; `commit()` must be called in order to
|
||||||
/// write operations out to disk. Unlike OverlayDB, `remove()` operations do not take effect
|
/// write operations out to disk. Unlike `OverlayDB`, `remove()` operations do not take effect
|
||||||
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
||||||
/// the removals actually take effect.
|
/// the removals actually take effect.
|
||||||
pub struct EarlyMergeDB {
|
pub struct EarlyMergeDB {
|
||||||
@ -528,6 +528,7 @@ impl JournalDB for EarlyMergeDB {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
#![cfg_attr(feature="dev", allow(similar_names))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! JournalDB interface and implementation.
|
//! `JournalDB` interface and implementation.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ mod earlymergedb;
|
|||||||
mod overlayrecentdb;
|
mod overlayrecentdb;
|
||||||
mod refcounteddb;
|
mod refcounteddb;
|
||||||
|
|
||||||
/// Export the JournalDB trait.
|
/// Export the `JournalDB` trait.
|
||||||
pub use self::traits::JournalDB;
|
pub use self::traits::JournalDB;
|
||||||
|
|
||||||
/// A journal database algorithm.
|
/// A journal database algorithm.
|
||||||
@ -70,7 +70,7 @@ impl fmt::Display for Algorithm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new JournalDB trait object.
|
/// Create a new `JournalDB` trait object.
|
||||||
pub fn new(path: &str, algorithm: Algorithm) -> Box<JournalDB> {
|
pub fn new(path: &str, algorithm: Algorithm) -> Box<JournalDB> {
|
||||||
match algorithm {
|
match algorithm {
|
||||||
Algorithm::Archive => Box::new(archivedb::ArchiveDB::new(path)),
|
Algorithm::Archive => Box::new(archivedb::ArchiveDB::new(path)),
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! JournalDB over in-memory overlay
|
//! `JournalDB` over in-memory overlay
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
@ -25,11 +25,11 @@ use kvdb::{Database, DBTransaction, DatabaseConfig};
|
|||||||
use std::env;
|
use std::env;
|
||||||
use super::JournalDB;
|
use super::JournalDB;
|
||||||
|
|
||||||
/// Implementation of the JournalDB trait for a disk-backed database with a memory overlay
|
/// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay
|
||||||
/// and, possibly, latent-removal semantics.
|
/// and, possibly, latent-removal semantics.
|
||||||
///
|
///
|
||||||
/// Like OverlayDB, there is a memory overlay; `commit()` must be called in order to
|
/// Like `OverlayDB`, there is a memory overlay; `commit()` must be called in order to
|
||||||
/// write operations out to disk. Unlike OverlayDB, `remove()` operations do not take effect
|
/// write operations out to disk. Unlike `OverlayDB`, `remove()` operations do not take effect
|
||||||
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
||||||
/// the removals actually take effect.
|
/// the removals actually take effect.
|
||||||
///
|
///
|
||||||
@ -359,6 +359,7 @@ impl HashDB for OverlayRecentDB {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
#![cfg_attr(feature="dev", allow(similar_names))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Disk-backed, ref-counted JournalDB implementation.
|
//! Disk-backed, ref-counted `JournalDB` implementation.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
@ -25,11 +25,11 @@ use kvdb::{Database, DBTransaction, DatabaseConfig};
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
/// Implementation of the HashDB trait for a disk-backed database with a memory overlay
|
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
|
||||||
/// and latent-removal semantics.
|
/// and latent-removal semantics.
|
||||||
///
|
///
|
||||||
/// Like OverlayDB, there is a memory overlay; `commit()` must be called in order to
|
/// Like `OverlayDB`, there is a memory overlay; `commit()` must be called in order to
|
||||||
/// write operations out to disk. Unlike OverlayDB, `remove()` operations do not take effect
|
/// write operations out to disk. Unlike `OverlayDB`, `remove()` operations do not take effect
|
||||||
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
/// immediately. Rather some age (based on a linear but arbitrary metric) must pass before
|
||||||
/// the removals actually take effect.
|
/// the removals actually take effect.
|
||||||
pub struct RefCountedDB {
|
pub struct RefCountedDB {
|
||||||
@ -195,6 +195,7 @@ impl JournalDB for RefCountedDB {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
#![cfg_attr(feature="dev", allow(blacklisted_name))]
|
||||||
|
#![cfg_attr(feature="dev", allow(similar_names))]
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Disk-backed HashDB implementation.
|
//! Disk-backed `HashDB` implementation.
|
||||||
|
|
||||||
use common::*;
|
use common::*;
|
||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
|
|
||||||
/// A HashDB which can manage a short-term journal potentially containing many forks of mutually
|
/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
|
||||||
/// exclusive actions.
|
/// exclusive actions.
|
||||||
pub trait JournalDB : HashDB + Send + Sync {
|
pub trait JournalDB : HashDB + Send + Sync {
|
||||||
/// Return a copy of ourself, in a box.
|
/// Return a copy of ourself, in a box.
|
||||||
|
@ -326,7 +326,7 @@ fn uuid_from_string(s: &str) -> Result<Uuid, UtilError> {
|
|||||||
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
/// Stored key file struct with encrypted message (cipher_text)
|
/// Stored key file struct with encrypted message (`cipher_text`)
|
||||||
/// also contains password derivation function settings (PBKDF2/Scrypt)
|
/// also contains password derivation function settings (PBKDF2/Scrypt)
|
||||||
pub struct KeyFileContent {
|
pub struct KeyFileContent {
|
||||||
version: KeyFileVersion,
|
version: KeyFileVersion,
|
||||||
@ -369,9 +369,9 @@ enum KeyFileParseError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl KeyFileContent {
|
impl KeyFileContent {
|
||||||
/// New stored key file struct with encrypted message (cipher_text)
|
/// New stored key file struct with encrypted message (`cipher_text`)
|
||||||
/// also contains password derivation function settings (PBKDF2/Scrypt)
|
/// also contains password derivation function settings (PBKDF2/Scrypt)
|
||||||
/// to decrypt cipher_text given the password is provided.
|
/// to decrypt `cipher_text` given the password is provided.
|
||||||
pub fn new(crypto: KeyFileCrypto) -> KeyFileContent {
|
pub fn new(crypto: KeyFileCrypto) -> KeyFileContent {
|
||||||
KeyFileContent {
|
KeyFileContent {
|
||||||
id: new_uuid(),
|
id: new_uuid(),
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Key-Value store abstraction with RocksDB backend.
|
//! Key-Value store abstraction with `RocksDB` backend.
|
||||||
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use rocksdb::{DB, Writable, WriteBatch, IteratorMode, DBVector, DBIterator,
|
use rocksdb::{DB, Writable, WriteBatch, IteratorMode, DBVector, DBIterator,
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Reference-counted memory-based HashDB implementation.
|
//! Reference-counted memory-based `HashDB` implementation.
|
||||||
|
|
||||||
use hash::*;
|
use hash::*;
|
||||||
use bytes::*;
|
use bytes::*;
|
||||||
@ -27,7 +27,7 @@ use std::collections::HashMap;
|
|||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
#[derive(Debug,Clone)]
|
#[derive(Debug,Clone)]
|
||||||
/// Reference-counted memory-based HashDB implementation.
|
/// Reference-counted memory-based `HashDB` implementation.
|
||||||
///
|
///
|
||||||
/// Use `new()` to create a new database. Insert items with `insert()`, remove items
|
/// Use `new()` to create a new database. Insert items with `insert()`, remove items
|
||||||
/// with `remove()`, check for existence with `containce()` and lookup a hash to derive
|
/// with `remove()`, check for existence with `containce()` and lookup a hash to derive
|
||||||
|
@ -223,7 +223,7 @@ pub enum WriteStatus {
|
|||||||
Complete
|
Complete
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RLPx packet
|
/// `RLPx` packet
|
||||||
pub struct Packet {
|
pub struct Packet {
|
||||||
pub protocol: u16,
|
pub protocol: u16,
|
||||||
pub data: Bytes,
|
pub data: Bytes,
|
||||||
@ -237,7 +237,7 @@ enum EncryptedConnectionState {
|
|||||||
Payload,
|
Payload,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Connection implementing RLPx framing
|
/// Connection implementing `RLPx` framing
|
||||||
/// https://github.com/ethereum/devp2p/blob/master/rlpx.md#framing
|
/// https://github.com/ethereum/devp2p/blob/master/rlpx.md#framing
|
||||||
pub struct EncryptedConnection {
|
pub struct EncryptedConnection {
|
||||||
/// Underlying tcp connection
|
/// Underlying tcp connection
|
||||||
|
@ -48,7 +48,7 @@ enum HandshakeState {
|
|||||||
StartSession,
|
StartSession,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RLPx protocol handhake. See https://github.com/ethereum/devp2p/blob/master/rlpx.md#encrypted-handshake
|
/// `RLPx` protocol handhake. See https://github.com/ethereum/devp2p/blob/master/rlpx.md#encrypted-handshake
|
||||||
pub struct Handshake {
|
pub struct Handshake {
|
||||||
/// Remote node public key
|
/// Remote node public key
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
@ -66,7 +66,7 @@ pub struct Handshake {
|
|||||||
pub remote_ephemeral: Public,
|
pub remote_ephemeral: Public,
|
||||||
/// Remote connection nonce.
|
/// Remote connection nonce.
|
||||||
pub remote_nonce: H256,
|
pub remote_nonce: H256,
|
||||||
/// Remote RLPx protocol version.
|
/// Remote `RLPx` protocol version.
|
||||||
pub remote_version: u64,
|
pub remote_version: u64,
|
||||||
/// A copy of received encryped auth packet
|
/// A copy of received encryped auth packet
|
||||||
pub auth_cipher: Bytes,
|
pub auth_cipher: Bytes,
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
//! Disk-backed HashDB implementation.
|
//! Disk-backed `HashDB` implementation.
|
||||||
|
|
||||||
use error::*;
|
use error::*;
|
||||||
use hash::*;
|
use hash::*;
|
||||||
@ -28,7 +28,7 @@ use std::env;
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use kvdb::{Database, DBTransaction};
|
use kvdb::{Database, DBTransaction};
|
||||||
|
|
||||||
/// Implementation of the HashDB trait for a disk-backed database with a memory overlay.
|
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay.
|
||||||
///
|
///
|
||||||
/// The operations `insert()` and `remove()` take place on the memory overlay; batches of
|
/// The operations `insert()` and `remove()` take place on the memory overlay; batches of
|
||||||
/// such operations may be flushed to the disk-backed DB with `commit()` or discarded with
|
/// such operations may be flushed to the disk-backed DB with `commit()` or discarded with
|
||||||
|
@ -153,7 +153,7 @@ impl <T>ToBytes for T where T: FixedHash {
|
|||||||
fn to_bytes_len(&self) -> usize { self.bytes().len() }
|
fn to_bytes_len(&self) -> usize { self.bytes().len() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error returned when FromBytes conversation goes wrong
|
/// Error returned when `FromBytes` conversation goes wrong
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum FromBytesError {
|
pub enum FromBytesError {
|
||||||
/// Expected more RLP data
|
/// Expected more RLP data
|
||||||
@ -174,7 +174,7 @@ impl fmt::Display for FromBytesError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Alias for the result of FromBytes trait
|
/// Alias for the result of `FromBytes` trait
|
||||||
pub type FromBytesResult<T> = Result<T, FromBytesError>;
|
pub type FromBytesResult<T> = Result<T, FromBytesError>;
|
||||||
|
|
||||||
/// Converts to given type from its bytes representation
|
/// Converts to given type from its bytes representation
|
||||||
|
@ -23,7 +23,7 @@ use super::trietraits::*;
|
|||||||
|
|
||||||
/// A `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
/// A `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
||||||
///
|
///
|
||||||
/// Use it as a `Trie` trait object. You can use `raw()` to get the backing TrieDB object.
|
/// Use it as a `Trie` trait object. You can use `raw()` to get the backing `TrieDB` object.
|
||||||
pub struct SecTrieDB<'db> {
|
pub struct SecTrieDB<'db> {
|
||||||
raw: TrieDB<'db>
|
raw: TrieDB<'db>
|
||||||
}
|
}
|
||||||
@ -36,12 +36,12 @@ impl<'db> SecTrieDB<'db> {
|
|||||||
SecTrieDB { raw: TrieDB::new(db, root) }
|
SecTrieDB { raw: TrieDB::new(db, root) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a reference to the underlying raw TrieDB struct.
|
/// Get a reference to the underlying raw `TrieDB` struct.
|
||||||
pub fn raw(&self) -> &TrieDB {
|
pub fn raw(&self) -> &TrieDB {
|
||||||
&self.raw
|
&self.raw
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a mutable reference to the underlying raw TrieDB struct.
|
/// Get a mutable reference to the underlying raw `TrieDB` struct.
|
||||||
pub fn raw_mut(&mut self) -> &TrieDB {
|
pub fn raw_mut(&mut self) -> &TrieDB {
|
||||||
&mut self.raw
|
&mut self.raw
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ use super::trietraits::*;
|
|||||||
|
|
||||||
/// A mutable `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
/// A mutable `Trie` implementation which hashes keys and uses a generic `HashDB` backing database.
|
||||||
///
|
///
|
||||||
/// Use it as a `Trie` or `TrieMut` trait object. You can use `raw()` to get the backing TrieDBMut object.
|
/// Use it as a `Trie` or `TrieMut` trait object. You can use `raw()` to get the backing `TrieDBMut` object.
|
||||||
pub struct SecTrieDBMut<'db> {
|
pub struct SecTrieDBMut<'db> {
|
||||||
raw: TrieDBMut<'db>
|
raw: TrieDBMut<'db>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user