ethcore finished

This commit is contained in:
NikVolf 2016-07-01 22:34:50 +03:00
parent 46b0af6121
commit edb8663195
6 changed files with 15 additions and 7 deletions

View File

@ -21,7 +21,7 @@ use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering};
use util::*; use util::*;
use util::panics::*; use util::panics::*;
use views::BlockView; use views::BlockView;
use error::{Error, ImportError, ExecutionError, BlockError, ImportResult}; use error::{ImportError, ExecutionError, BlockError, ImportResult};
use header::{BlockNumber}; use header::{BlockNumber};
use state::State; use state::State;
use spec::Spec; use spec::Spec;
@ -779,7 +779,11 @@ impl BlockChainClient for Client {
nonce: self.latest_nonce(a), nonce: self.latest_nonce(a),
balance: self.latest_balance(a), balance: self.latest_balance(a),
}; };
self.miner.import_transactions(self, transactions, fetch_account)
self.miner.import_transactions(self, transactions, &fetch_account)
.into_iter()
.map(|res| res.map_err(|e| e.into()))
.collect()
} }
fn queue_transactions(&self, transactions: Vec<Bytes>) { fn queue_transactions(&self, transactions: Vec<Bytes>) {

View File

@ -47,7 +47,6 @@ use error::{ImportResult, ExecutionError};
use receipt::LocalizedReceipt; use receipt::LocalizedReceipt;
use trace::LocalizedTrace; use trace::LocalizedTrace;
use evm::Factory as EvmFactory; use evm::Factory as EvmFactory;
use error::Error as EthError;
pub use block_import_error::BlockImportError; pub use block_import_error::BlockImportError;
pub use transaction_import::{TransactionImportResult, TransactionImportError}; pub use transaction_import::{TransactionImportResult, TransactionImportError};

View File

@ -40,7 +40,6 @@ use error::{ExecutionError};
use trace::LocalizedTrace; use trace::LocalizedTrace;
use miner::{TransactionImportResult, AccountDetails}; use miner::{TransactionImportResult, AccountDetails};
use error::Error as EthError;
/// Test client. /// Test client.
pub struct TestBlockChainClient { pub struct TestBlockChainClient {
@ -498,6 +497,9 @@ impl BlockChainClient for TestBlockChainClient {
}; };
self.miner.import_transactions(self, transactions, &fetch_account) self.miner.import_transactions(self, transactions, &fetch_account)
.into_iter()
.map(|res| res.map_err(|e| e.into()))
.collect()
} }
fn queue_transactions(&self, transactions: Vec<Bytes>) { fn queue_transactions(&self, transactions: Vec<Bytes>) {

View File

@ -22,10 +22,9 @@ use basic_types::LogBloom;
use client::Error as ClientError; use client::Error as ClientError;
pub use types::executed::ExecutionError; pub use types::executed::ExecutionError;
use ipc::binary::{BinaryConvertError, BinaryConvertable}; use ipc::binary::{BinaryConvertError, BinaryConvertable};
use types::transaction_import::TransactionImportError;
use types::block_import_error::BlockImportError; use types::block_import_error::BlockImportError;
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Clone)]
/// Errors concerning transaction processing. /// Errors concerning transaction processing.
pub enum TransactionError { pub enum TransactionError {
/// Transaction is already imported to the queue /// Transaction is already imported to the queue

View File

@ -20,6 +20,7 @@ use ipc::binary::{BinaryConvertError, BinaryConvertable};
use std::collections::VecDeque; use std::collections::VecDeque;
use error::{TransactionError, Error}; use error::{TransactionError, Error};
use std::mem; use std::mem;
use util::Populatable;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
/// Represents the result of importing transaction. /// Represents the result of importing transaction.
@ -32,9 +33,12 @@ pub enum TransactionImportResult {
binary_fixed_size!(TransactionImportResult); binary_fixed_size!(TransactionImportResult);
/// Api-level error for transaction import
#[derive(Debug, Clone, Binary)] #[derive(Debug, Clone, Binary)]
pub enum TransactionImportError { pub enum TransactionImportError {
/// Transaction error
Transaction(TransactionError), Transaction(TransactionError),
/// Other error
Other(String), Other(String),
} }

View File

@ -101,7 +101,7 @@ impl<T: fmt::Debug + fmt::Display> fmt::Display for Mismatch<T> {
} }
} }
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq, Clone)]
/// Error indicating value found is outside of a valid range. /// Error indicating value found is outside of a valid range.
pub struct OutOfBounds<T: fmt::Debug> { pub struct OutOfBounds<T: fmt::Debug> {
/// Minimum allowed value. /// Minimum allowed value.