Merge branch 'master' into auth-bft

This commit is contained in:
keorn
2016-12-10 18:14:35 +01:00
53 changed files with 441 additions and 428 deletions

View File

@@ -25,7 +25,7 @@ use io::{PanicHandler, ForwardPanic};
use util::{ToPretty, Uint, U256, H256, Address, Hashable};
use rlp::PayloadInfo;
use ethcore::service::ClientService;
use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, BlockImportError, BlockChainClient, BlockID};
use ethcore::client::{Mode, DatabaseCompactionProfile, VMType, BlockImportError, BlockChainClient, BlockId};
use ethcore::error::ImportError;
use ethcore::miner::Miner;
use ethcore::verification::queue::VerifierSettings;
@@ -101,8 +101,8 @@ pub struct ExportBlockchain {
pub wal: bool,
pub fat_db: Switch,
pub tracing: Switch,
pub from_block: BlockID,
pub to_block: BlockID,
pub from_block: BlockId,
pub to_block: BlockId,
pub check_seal: bool,
}
@@ -119,7 +119,7 @@ pub struct ExportState {
pub wal: bool,
pub fat_db: Switch,
pub tracing: Switch,
pub at: BlockID,
pub at: BlockId,
pub storage: bool,
pub code: bool,
pub min_balance: Option<U256>,
@@ -384,7 +384,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<String, String> {
if i % 10000 == 0 {
info!("#{}", i);
}
let b = try!(client.block(BlockID::Number(i)).ok_or("Error exporting incomplete chain"));
let b = try!(client.block(BlockId::Number(i)).ok_or("Error exporting incomplete chain"));
match format {
DataFormat::Binary => { out.write(&b).expect("Couldn't write to stream."); }
DataFormat::Hex => { out.write_fmt(format_args!("{}", b.pretty())).expect("Couldn't write to stream."); }

View File

@@ -730,7 +730,7 @@ mod tests {
use super::*;
use cli::Args;
use ethcore_rpc::NetworkSettings;
use ethcore::client::{VMType, BlockID};
use ethcore::client::{VMType, BlockId};
use ethcore::miner::{MinerOptions, PrioritizationStrategy};
use helpers::{replace_home, default_network_config};
use run::RunCmd;
@@ -839,8 +839,8 @@ mod tests {
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
from_block: BlockID::Number(1),
to_block: BlockID::Latest,
from_block: BlockId::Number(1),
to_block: BlockId::Latest,
check_seal: true,
})));
}
@@ -861,7 +861,7 @@ mod tests {
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
at: BlockID::Latest,
at: BlockId::Latest,
storage: true,
code: true,
min_balance: None,
@@ -885,8 +885,8 @@ mod tests {
wal: true,
tracing: Default::default(),
fat_db: Default::default(),
from_block: BlockID::Number(1),
to_block: BlockID::Latest,
from_block: BlockId::Number(1),
to_block: BlockId::Latest,
check_seal: true,
})));
}

View File

@@ -106,7 +106,7 @@ mod server {
use util::{Bytes, Address, U256};
use ethcore::transaction::{Transaction, Action};
use ethcore::client::{Client, BlockChainClient, BlockID};
use ethcore::client::{Client, BlockChainClient, BlockId};
use rpc_apis;
use ethcore_rpc::is_major_importing;
@@ -182,7 +182,7 @@ mod server {
data: data,
}.fake_sign(from);
self.client.call(&transaction, BlockID::Latest, Default::default())
self.client.call(&transaction, BlockId::Latest, Default::default())
.map_err(|e| format!("{:?}", e))
.map(|executed| {
executed.output

View File

@@ -20,7 +20,7 @@ use std::time::Duration;
use std::fs::File;
use util::{clean_0x, U256, Uint, Address, path, CompactionProfile};
use util::journaldb::Algorithm;
use ethcore::client::{Mode, BlockID, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
use cache::CacheConfig;
use dir::DatabaseDirectories;
@@ -62,13 +62,13 @@ pub fn to_mode(s: &str, timeout: u64, alarm: u64) -> Result<Mode, String> {
}
}
pub fn to_block_id(s: &str) -> Result<BlockID, String> {
pub fn to_block_id(s: &str) -> Result<BlockId, String> {
if s == "latest" {
Ok(BlockID::Latest)
Ok(BlockId::Latest)
} else if let Ok(num) = s.parse() {
Ok(BlockID::Number(num))
Ok(BlockId::Number(num))
} else if let Ok(hash) = s.parse() {
Ok(BlockID::Hash(hash))
Ok(BlockId::Hash(hash))
} else {
Err("Invalid block.".into())
}
@@ -327,7 +327,7 @@ mod tests {
use std::io::Write;
use devtools::RandomTempPath;
use util::{U256};
use ethcore::client::{Mode, BlockID};
use ethcore::client::{Mode, BlockId};
use ethcore::miner::PendingSet;
use super::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_address, to_addresses, to_price, geth_ipc_path, to_bootnodes, password_from_file};
@@ -361,13 +361,13 @@ mod tests {
#[test]
fn test_to_block_id() {
assert_eq!(to_block_id("latest").unwrap(), BlockID::Latest);
assert_eq!(to_block_id("0").unwrap(), BlockID::Number(0));
assert_eq!(to_block_id("2").unwrap(), BlockID::Number(2));
assert_eq!(to_block_id("15").unwrap(), BlockID::Number(15));
assert_eq!(to_block_id("latest").unwrap(), BlockId::Latest);
assert_eq!(to_block_id("0").unwrap(), BlockId::Number(0));
assert_eq!(to_block_id("2").unwrap(), BlockId::Number(2));
assert_eq!(to_block_id("15").unwrap(), BlockId::Number(15));
assert_eq!(
to_block_id("9fc84d84f6a785dc1bd5abacfcf9cbdd3b6afb80c0f799bfb2fd42c44a0c224e").unwrap(),
BlockID::Hash("9fc84d84f6a785dc1bd5abacfcf9cbdd3b6afb80c0f799bfb2fd42c44a0c224e".parse().unwrap())
BlockId::Hash("9fc84d84f6a785dc1bd5abacfcf9cbdd3b6afb80c0f799bfb2fd42c44a0c224e".parse().unwrap())
);
}

View File

@@ -188,7 +188,7 @@ impl ChainNotify for Informant {
.sum();
if ripe {
if let Some(block) = imported.last().and_then(|h| self.client.block(BlockID::Hash(*h))) {
if let Some(block) = imported.last().and_then(|h| self.client.block(BlockId::Hash(*h))) {
let view = BlockView::new(&block);
let header = view.header();
let tx_count = view.transactions_count();

View File

@@ -26,7 +26,7 @@ use ethcore::snapshot::service::Service as SnapshotService;
use ethcore::service::ClientService;
use ethcore::client::{Mode, DatabaseCompactionProfile, VMType};
use ethcore::miner::Miner;
use ethcore::ids::BlockID;
use ethcore::ids::BlockId;
use cache::CacheConfig;
use params::{SpecType, Pruning, Switch, tracing_switch_to_bool, fatdb_switch_to_bool};
@@ -60,7 +60,7 @@ pub struct SnapshotCommand {
pub file_path: Option<String>,
pub wal: bool,
pub kind: Kind,
pub block_at: BlockID,
pub block_at: BlockId,
}
// helper for reading chunks from arbitrary reader and feeding them into the