few additional rpc eth methods

This commit is contained in:
debris
2016-02-05 13:21:34 +01:00
parent 4af8adc89a
commit 432c0d59c4
5 changed files with 69 additions and 13 deletions

View File

@@ -139,6 +139,11 @@ impl<'a> BlockView<'a> {
self.rlp.val_at(1)
}
/// Return number of transactions in given block, without deserializing them.
pub fn transactions_count(&self) -> usize {
self.rlp.at(1).iter().count()
}
/// Return List of transactions in given block.
pub fn transaction_views(&self) -> Vec<TransactionView> {
self.rlp.at(1).iter().map(TransactionView::new_from_rlp).collect()
@@ -154,6 +159,11 @@ impl<'a> BlockView<'a> {
self.rlp.val_at(2)
}
/// Return number of uncles in given block, without deserializing them.
pub fn uncles_count(&self) -> usize {
self.rlp.at(2).iter().count()
}
/// Return List of transactions in given block.
pub fn uncle_views(&self) -> Vec<HeaderView> {
self.rlp.at(2).iter().map(HeaderView::new_from_rlp).collect()