fix remaining tests & doctest
This commit is contained in:
parent
cee31f9e8d
commit
db749dc564
@ -28,7 +28,7 @@ use receipt::{Receipt, LocalizedReceipt};
|
||||
use blockchain::extras::BlockReceipts;
|
||||
use error::{ImportResult};
|
||||
use evm::Factory as EvmFactory;
|
||||
use miner::Miner;
|
||||
use miner::{Miner, MinerService};
|
||||
|
||||
use block_queue::BlockQueueInfo;
|
||||
use block::{SealedBlock, ClosedBlock, LockedBlock};
|
||||
@ -488,10 +488,17 @@ impl BlockChainClient for TestBlockChainClient {
|
||||
}
|
||||
|
||||
fn import_transactions(&self, transactions: Vec<SignedTransaction>) -> Vec<Result<TransactionImportResult, EthError>> {
|
||||
unimplemented!();
|
||||
let nonces = self.nonces.read().unwrap();
|
||||
let balances = self.balances.read().unwrap();
|
||||
let fetch_account = |a: &Address| AccountDetails {
|
||||
nonce: nonces[a],
|
||||
balance: balances[a],
|
||||
};
|
||||
|
||||
self.miner.import_transactions(transactions, &fetch_account)
|
||||
}
|
||||
|
||||
fn all_transactions(&self) -> Vec<SignedTransaction> {
|
||||
unimplemented!();
|
||||
self.miner.all_transactions()
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,6 @@ use io::SyncIo;
|
||||
use time;
|
||||
use super::SyncConfig;
|
||||
use blocks::BlockCollection;
|
||||
use ethcore::miner::{AccountDetails, TransactionImportResult, MinerService};
|
||||
|
||||
known_heap_size!(0, PeerInfo);
|
||||
|
||||
@ -895,11 +894,6 @@ impl ChainSync {
|
||||
let tx: SignedTransaction = try!(r.val_at(i));
|
||||
transactions.push(tx);
|
||||
}
|
||||
let chain = io.chain();
|
||||
let fetch_account = |a: &Address| AccountDetails {
|
||||
nonce: chain.latest_nonce(a),
|
||||
balance: chain.latest_balance(a),
|
||||
};
|
||||
let _ = io.chain().import_transactions(transactions);
|
||||
Ok(())
|
||||
}
|
||||
@ -1296,7 +1290,6 @@ mod tests {
|
||||
use ethcore::views::BlockView;
|
||||
use ethcore::header::*;
|
||||
use ethcore::client::*;
|
||||
use ethcore::spec::Spec;
|
||||
use ethcore::miner::MinerService;
|
||||
|
||||
fn get_dummy_block(order: u32, parent_hash: H256) -> Bytes {
|
||||
@ -1702,6 +1695,7 @@ mod tests {
|
||||
{
|
||||
let mut queue = VecDeque::new();
|
||||
let mut io = TestIo::new(&mut client, &mut queue, None);
|
||||
io.chain.miner.chain_new_blocks(io.chain, &[], &[], &[], &good_blocks);
|
||||
sync.chain_new_blocks(&mut io, &[], &[], &[], &good_blocks);
|
||||
assert_eq!(io.chain.miner.status().transactions_in_future_queue, 0);
|
||||
assert_eq!(io.chain.miner.status().transactions_in_pending_queue, 1);
|
||||
@ -1715,6 +1709,7 @@ mod tests {
|
||||
{
|
||||
let mut queue = VecDeque::new();
|
||||
let mut io = TestIo::new(&mut client, &mut queue, None);
|
||||
io.chain.miner.chain_new_blocks(io.chain, &[], &[], &good_blocks, &retracted_blocks);
|
||||
sync.chain_new_blocks(&mut io, &[], &[], &good_blocks, &retracted_blocks);
|
||||
}
|
||||
|
||||
|
@ -32,21 +32,20 @@
|
||||
//! extern crate ethcore_util as util;
|
||||
//! extern crate ethcore;
|
||||
//! extern crate ethsync;
|
||||
//! extern crate ethminer;
|
||||
//! use std::env;
|
||||
//! use std::sync::Arc;
|
||||
//! use util::network::{NetworkService, NetworkConfiguration};
|
||||
//! use ethcore::client::{Client, ClientConfig};
|
||||
//! use ethsync::{EthSync, SyncConfig};
|
||||
//! use ethminer::Miner;
|
||||
//! use ethcore::ethereum;
|
||||
//! use ethcore::miner::Miner;
|
||||
//!
|
||||
//! fn main() {
|
||||
//! let mut service = NetworkService::start(NetworkConfiguration::new()).unwrap();
|
||||
//! let dir = env::temp_dir();
|
||||
//! let client = Client::new(ClientConfig::default(), ethereum::new_frontier(), &dir, service.io().channel()).unwrap();
|
||||
//! let client = Client::new(ClientConfig::default(), ethereum::new_frontier(), &dir, Arc::new(Miner::default()), service.io().channel()).unwrap();
|
||||
//! let miner = Miner::new(false, ethereum::new_frontier());
|
||||
//! EthSync::register(&mut service, SyncConfig::default(), client, miner);
|
||||
//! EthSync::register(&mut service, SyncConfig::default(), client);
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
|
@ -15,8 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use util::*;
|
||||
use ethcore::client::{TestBlockChainClient, MiningBlockChainClient, BlockChainClient};
|
||||
use ethcore::spec::Spec;
|
||||
use ethcore::client::{TestBlockChainClient, BlockChainClient};
|
||||
use io::SyncIo;
|
||||
use chain::ChainSync;
|
||||
use ::SyncConfig;
|
||||
|
Loading…
Reference in New Issue
Block a user