@@ -23,8 +23,7 @@ mod impls;
|
||||
mod types;
|
||||
mod helpers;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
pub mod tests;
|
||||
|
||||
pub use self::traits::{Web3, Eth, EthFilter, Personal, Net};
|
||||
pub use self::impls::*;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Test implementation of account provider.
|
||||
|
||||
use std::sync::RwLock;
|
||||
use std::collections::HashMap;
|
||||
use std::io;
|
||||
@@ -31,6 +33,7 @@ pub struct TestAccount {
|
||||
}
|
||||
|
||||
impl TestAccount {
|
||||
/// Creates new test account.
|
||||
pub fn new(password: &str) -> Self {
|
||||
TestAccount {
|
||||
unlocked: false,
|
||||
@@ -42,6 +45,7 @@ impl TestAccount {
|
||||
/// Test account provider.
|
||||
pub struct TestAccountProvider {
|
||||
accounts: RwLock<HashMap<Address, TestAccount>>,
|
||||
/// Added accounts passwords.
|
||||
pub adds: RwLock<Vec<String>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,12 @@ use v1::helpers::ExternalMinerService;
|
||||
|
||||
/// Test ExternalMinerService;
|
||||
pub struct TestExternalMiner {
|
||||
/// External miners hashrates.
|
||||
pub hashrates: Arc<RwLock<HashMap<H256, U256>>>
|
||||
}
|
||||
|
||||
impl TestExternalMiner {
|
||||
/// Creates new external miner.
|
||||
pub fn new(hashrates: Arc<RwLock<HashMap<H256, U256>>>) -> Self {
|
||||
TestExternalMiner {
|
||||
hashrates: hashrates,
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Test implementation of miner service.
|
||||
|
||||
use util::{Address, H256, Bytes};
|
||||
use util::standard::*;
|
||||
use ethcore::error::Error;
|
||||
@@ -22,8 +24,11 @@ use ethcore::block::ClosedBlock;
|
||||
use ethcore::transaction::SignedTransaction;
|
||||
use ethminer::{MinerService, MinerStatus, AccountDetails};
|
||||
|
||||
/// Test miner service.
|
||||
pub struct TestMinerService {
|
||||
/// Imported transactions.
|
||||
pub imported_transactions: RwLock<Vec<H256>>,
|
||||
/// Latest closed block.
|
||||
pub latest_closed_block: Mutex<Option<ClosedBlock>>,
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Test rpc services.
|
||||
|
||||
mod account_provider;
|
||||
mod sync_provider;
|
||||
mod miner_service;
|
||||
|
||||
@@ -14,19 +14,27 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Test implementation of SyncProvider.
|
||||
|
||||
use ethsync::{SyncProvider, SyncStatus, SyncState};
|
||||
use std::sync::{RwLock};
|
||||
|
||||
/// TestSyncProvider config.
|
||||
pub struct Config {
|
||||
/// Protocol version.
|
||||
pub protocol_version: u8,
|
||||
/// Number of peers.
|
||||
pub num_peers: usize,
|
||||
}
|
||||
|
||||
/// Test sync provider.
|
||||
pub struct TestSyncProvider {
|
||||
/// Sync status.
|
||||
pub status: RwLock<SyncStatus>,
|
||||
}
|
||||
|
||||
impl TestSyncProvider {
|
||||
/// Creates new sync provider.
|
||||
pub fn new(config: Config) -> Self {
|
||||
TestSyncProvider {
|
||||
status: RwLock::new(SyncStatus {
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
|
||||
//!TODO: load custom blockchain state and test
|
||||
|
||||
pub mod helpers;
|
||||
#[cfg(test)]
|
||||
mod eth;
|
||||
#[cfg(test)]
|
||||
mod net;
|
||||
#[cfg(test)]
|
||||
mod web3;
|
||||
mod helpers;
|
||||
#[cfg(test)]
|
||||
mod personal;
|
||||
|
||||
Reference in New Issue
Block a user