sorting with transaction result

This commit is contained in:
NikVolf 2016-06-29 21:35:22 +03:00
parent f31ddec3a8
commit a14f2391ff
5 changed files with 37 additions and 10 deletions

View File

@ -797,7 +797,9 @@ 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).iter()
.map(|res| res.map_err(|e| format!("{:?}", e)))
.collect::<Vec<Result<TransactionImportResult, String>>>()
} }
fn queue_transactions(&self, transactions: Vec<Bytes>) { fn queue_transactions(&self, transactions: Vec<Bytes>) {

View File

@ -90,6 +90,7 @@ use util::hash::{Address, H256};
use util::table::*; use util::table::*;
use transaction::*; use transaction::*;
use error::{Error, TransactionError}; use error::{Error, TransactionError};
pub use types::transaction_import_result::TransactionImportResult;
/// Transaction origin /// Transaction origin
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
@ -310,15 +311,6 @@ pub struct TransactionQueueStatus {
pub future: usize, pub future: usize,
} }
#[derive(Debug, PartialEq)]
/// Represents the result of importing transaction.
pub enum TransactionImportResult {
/// Transaction was imported to current queue.
Current,
/// Transaction was imported to future queue.
Future
}
/// Details of account /// Details of account
pub struct AccountDetails { pub struct AccountDetails {
/// Most recent account nonce /// Most recent account nonce

View File

@ -14,6 +14,10 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
/// Block queue status /// Block queue status
#[derive(Debug, Binary)] #[derive(Debug, Binary)]
pub struct BlockQueueInfo { pub struct BlockQueueInfo {

View File

@ -26,3 +26,4 @@ pub mod block_status;
pub mod account_diff; pub mod account_diff;
pub mod state_diff; pub mod state_diff;
pub mod block_queue_info; pub mod block_queue_info;
pub mod transaction_import_result;

View File

@ -0,0 +1,28 @@
// Copyright 2015, 2016 Ethcore (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::mem;
use ipc::binary::BinaryConvertError;
use std::collections::VecDeque;
#[derive(Debug, PartialEq)]
/// Represents the result of importing transaction.
pub enum TransactionImportResult {
/// Transaction was imported to current queue.
Current,
/// Transaction was imported to future queue.
Future
}