moved BlockId and TransactionId to blockchain.rs

This commit is contained in:
debris 2016-02-10 15:06:13 +01:00
parent 75b54cc277
commit dc8fa4ebfd
5 changed files with 22 additions and 20 deletions

View File

@ -23,6 +23,24 @@ use extras::*;
use transaction::*;
use views::*;
/// Uniquely identifies block.
pub enum BlockId {
/// Block's sha3.
/// Querying by hash is always faster.
Hash(H256),
/// Block number within canon blockchain.
Number(BlockNumber)
}
/// Uniquely identifies transaction.
pub enum TransactionId {
/// Transaction's sha3.
Hash(H256),
/// Block id and transaction index within this block.
/// Querying by block position is always faster.
BlockPosition(BlockId, usize)
}
/// Represents a tree route between `from` block and `to` block:
pub struct TreeRoute {
/// A vector of hashes of all blocks, ordered from `from` to `to`.
@ -674,7 +692,6 @@ mod tests {
use util::hash::*;
use blockchain::*;
use tests::helpers::*;
use views::TransactionId;
#[test]
fn valid_tests_extra32() {

View File

@ -18,8 +18,8 @@
use util::*;
use rocksdb::{Options, DB, DBCompactionStyle};
use blockchain::{BlockChain, BlockProvider, CacheSize};
use views::{BlockView, TransactionId};
use blockchain::{BlockChain, BlockProvider, CacheSize, TransactionId};
use views::BlockView;
use error::*;
use header::BlockNumber;
use state::State;

View File

@ -19,22 +19,6 @@ use util::*;
use header::*;
use transaction::*;
/// Uniquely identifies block.
pub enum BlockId {
/// Block's sha3.
Hash(H256),
/// Block number within canon blockchain.
Number(BlockNumber)
}
/// Uniquely identifies transaction.
pub enum TransactionId {
/// Transaction's sha3.
Hash(H256),
/// Block id and transaction index within this block.
BlockPosition(BlockId, usize)
}
/// View onto transaction rlp.
pub struct TransactionView<'a> {
rlp: Rlp<'a>

View File

@ -22,6 +22,7 @@ use util::uint::*;
use util::sha3::*;
use ethcore::client::*;
use ethcore::views::*;
use ethcore::blockchain::{BlockId, TransactionId};
use v1::traits::{Eth, EthFilter};
use v1::types::{Block, BlockTransactions, BlockNumber, Bytes, SyncStatus, Transaction, OptionalValue, Index};

View File

@ -23,7 +23,7 @@ use io::SyncIo;
use chain::{ChainSync};
use ethcore::receipt::Receipt;
use ethcore::transaction::LocalizedTransaction;
use ethcore::views::TransactionId;
use ethcore::blockchain::TransactionId;
pub struct TestBlockChainClient {
pub blocks: RwLock<HashMap<H256, Bytes>>,