fixing json_tests

This commit is contained in:
Tomasz Drwięga 2016-06-24 10:49:13 +02:00
parent 6edb981bfa
commit 34c89e5841
2 changed files with 19 additions and 11 deletions

View File

@ -41,20 +41,28 @@ pub fn json_chain_test(json_data: &[u8], era: ChainEra) -> Vec<String> {
flush!(" - {}...", name); flush!(" - {}...", name);
let mut spec = match era { let spec = || {
ChainEra::Frontier => ethereum::new_frontier_test(), let genesis = Genesis::from(blockchain.genesis());
ChainEra::Homestead => ethereum::new_homestead_test(), let state = From::from(blockchain.pre_state.clone());
let mut spec = match era {
ChainEra::Frontier => ethereum::new_frontier_test(),
ChainEra::Homestead => ethereum::new_homestead_test(),
};
spec.set_genesis_state(state);
spec.overwrite_genesis_params(genesis);
assert!(spec.is_state_root_valid());
spec
}; };
let genesis = Genesis::from(blockchain.genesis());
let state = From::from(blockchain.pre_state.clone());
spec.set_genesis_state(state);
spec.overwrite_genesis_params(genesis);
assert!(spec.is_state_root_valid());
let temp = RandomTempPath::new(); let temp = RandomTempPath::new();
{ {
let client = Client::new(ClientConfig::default(), spec.clone(), temp.as_path(), Arc::new(Miner::with_spec(spec)), IoChannel::disconnected()).unwrap(); let client = Client::new(
ClientConfig::default(),
spec(),
temp.as_path(),
Arc::new(Miner::with_spec(spec())),
IoChannel::disconnected()
).unwrap();
for b in &blockchain.blocks_rlp() { for b in &blockchain.blocks_rlp() {
if Block::is_good(&b) { if Block::is_good(&b) {
let _ = client.import_block(b.clone()); let _ = client.import_block(b.clone());

View File

@ -33,7 +33,7 @@
//! use ethcore::miner::{Miner, MinerService}; //! use ethcore::miner::{Miner, MinerService};
//! //!
//! fn main() { //! fn main() {
//! let miner: Miner = Miner::with_spec(ethereum::new_frontier()); //! let miner: Miner = Miner::with_spec(ethereum::new_frontier(true));
//! // get status //! // get status
//! assert_eq!(miner.status().transactions_in_pending_queue, 0); //! assert_eq!(miner.status().transactions_in_pending_queue, 0);
//! //!