unify loading spec && further spec cleanups (#10948)
* bundle_* macros for spec * fixed failing tests * renamed bundle.rs to chain.rs * removed unused derives * updated spec/chain.rs description
This commit is contained in:
@@ -19,6 +19,7 @@ use ethcore::client::{TestBlockChainClient, BlockChainClient, BlockId, EachBlock
|
||||
use chain::{SyncState};
|
||||
use super::helpers::*;
|
||||
use {SyncConfig, WarpSync};
|
||||
use ethcore::spec;
|
||||
|
||||
#[test]
|
||||
fn two_peers() {
|
||||
@@ -101,7 +102,7 @@ fn forked_with_misbehaving_peer() {
|
||||
::env_logger::try_init().ok();
|
||||
let mut net = TestNet::new(3);
|
||||
|
||||
let mut alt_spec = ::ethcore::spec::Spec::new_test();
|
||||
let mut alt_spec = spec::new_test();
|
||||
alt_spec.extra_data = b"fork".to_vec();
|
||||
// peer 0 is on a totally different chain with higher total difficulty
|
||||
net.peer_mut(0).chain = Arc::new(TestBlockChainClient::new_with_spec(alt_spec));
|
||||
|
||||
@@ -20,7 +20,7 @@ use ethereum_types::{U256, Address};
|
||||
use io::{IoHandler, IoChannel};
|
||||
use ethcore::client::{ChainInfo, ClientIoMessage};
|
||||
use ethcore::engines;
|
||||
use ethcore::spec::Spec;
|
||||
use ethcore::spec;
|
||||
use ethcore::miner::{self, MinerService};
|
||||
use ethkey::{KeyPair, Secret};
|
||||
use types::transaction::{Action, PendingTransaction, Transaction};
|
||||
@@ -44,8 +44,8 @@ fn authority_round() {
|
||||
let s0 = KeyPair::from_secret_slice(keccak("1").as_bytes()).unwrap();
|
||||
let s1 = KeyPair::from_secret_slice(keccak("0").as_bytes()).unwrap();
|
||||
|
||||
let chain_id = Spec::new_test_round().chain_id();
|
||||
let mut net = TestNet::with_spec(2, SyncConfig::default(), Spec::new_test_round);
|
||||
let chain_id = spec::new_test_round().chain_id();
|
||||
let mut net = TestNet::with_spec(2, SyncConfig::default(), spec::new_test_round);
|
||||
let io_handler0: Arc<dyn IoHandler<ClientIoMessage>> = Arc::new(TestIoHandler::new(net.peer(0).chain.clone()));
|
||||
let io_handler1: Arc<dyn IoHandler<ClientIoMessage>> = Arc::new(TestIoHandler::new(net.peer(1).chain.clone()));
|
||||
// Push transaction to both clients. Only one of them gets lucky to produce a block.
|
||||
|
||||
@@ -25,7 +25,7 @@ use tests::snapshot::*;
|
||||
use ethcore::client::{TestBlockChainClient, BlockChainClient, Client as EthcoreClient,
|
||||
ClientConfig, ChainNotify, NewBlocks, ChainMessageType, ClientIoMessage};
|
||||
use ethcore::snapshot::SnapshotService;
|
||||
use ethcore::spec::Spec;
|
||||
use ethcore::spec::{self, Spec};
|
||||
use ethcore::miner::Miner;
|
||||
use ethcore::test_helpers;
|
||||
use sync_io::SyncIo;
|
||||
@@ -351,7 +351,7 @@ impl TestNet<EthPeer<TestBlockChainClient>> {
|
||||
sync: RwLock::new(sync),
|
||||
snapshot_service: ss,
|
||||
chain: Arc::new(chain),
|
||||
miner: Arc::new(Miner::new_for_tests(&Spec::new_test(), None)),
|
||||
miner: Arc::new(Miner::new_for_tests(&spec::new_test(), None)),
|
||||
queue: RwLock::new(VecDeque::new()),
|
||||
private_tx_handler,
|
||||
io_queue: RwLock::new(VecDeque::new()),
|
||||
|
||||
Reference in New Issue
Block a user