openethereum/ethcore/src/client/trace.rs
Nikolay Volf 8282c7dd50 Client IPC Interface (#1493)
* btree map serializer

* serde tests

* state diff serialization

* basic layout

* more missing serializaers

* uncle returns rlp

* block queue info

* sorting with transaction result

* sorting out util imports

* transaction import result sorting also

* sorting filters & ranges

* error sorting out

* deriving ipc service compiling

* rpc & sync recompile

* sorting rpc using uncles

* fix compilation

* fix merging bugs

* fix unused imports

* fix all warnings

* tests stub

* some merge bugs

* ethcore compilation

* fix rpc compilation

* deriving attribute

* tests (and fixes)

* rpc test working

* fix warnings again

* rs.in -> rs

* missing attribute

* refactored tree changes

* paste reformat mess fix

* pub mod actually

* intendation fix
2016-07-07 09:39:32 +02:00

28 lines
774 B
Rust

//! Bridge between Tracedb and Blockchain.
use util::{H256};
use header::BlockNumber;
use trace::DatabaseExtras as TraceDatabaseExtras;
use blockchain::{BlockChain, BlockProvider};
use blockchain::extras::TransactionAddress;
pub use types::trace_filter::Filter;
impl TraceDatabaseExtras for BlockChain {
fn block_hash(&self, block_number: BlockNumber) -> Option<H256> {
(self as &BlockProvider).block_hash(block_number)
}
fn transaction_hash(&self, block_number: BlockNumber, tx_position: usize) -> Option<H256> {
(self as &BlockProvider).block_hash(block_number)
.and_then(|block_hash| {
let tx_address = TransactionAddress {
block_hash: block_hash,
index: tx_position
};
self.transaction(&tx_address)
})
.map(|tx| tx.hash())
}
}