uncle rlp in block view
This commit is contained in:
parent
7ad8599324
commit
d4ff3e51e9
@ -582,7 +582,7 @@ impl BlockChainClient for Client {
|
|||||||
|
|
||||||
fn uncle(&self, id: UncleID) -> Option<Bytes> {
|
fn uncle(&self, id: UncleID) -> Option<Bytes> {
|
||||||
let index = id.position;
|
let index = id.position;
|
||||||
self.block(id.block).and_then(|block| BlockView::new(&block).uncle_at(index).and_then(|u| Some(u.rlp(Seal::With))))
|
self.block(id.block).and_then(|block| BlockView::new(&block).uncle_rlp_at(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn transaction_receipt(&self, id: TransactionID) -> Option<LocalizedReceipt> {
|
fn transaction_receipt(&self, id: TransactionID) -> Option<LocalizedReceipt> {
|
||||||
|
@ -139,6 +139,11 @@ impl<'a> BlockView<'a> {
|
|||||||
pub fn uncle_at(&self, index: usize) -> Option<Header> {
|
pub fn uncle_at(&self, index: usize) -> Option<Header> {
|
||||||
self.rlp.at(2).iter().nth(index).map(|rlp| rlp.as_val())
|
self.rlp.at(2).iter().nth(index).map(|rlp| rlp.as_val())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return nth uncle rlp.
|
||||||
|
pub fn uncle_rlp_at(&self, index: usize) -> Option<Bytes> {
|
||||||
|
self.rlp.at(2).iter().nth(index).map(|rlp| rlp.as_raw().to_vec())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Hashable for BlockView<'a> {
|
impl<'a> Hashable for BlockView<'a> {
|
||||||
|
Loading…
Reference in New Issue
Block a user