transaction by block number and index

This commit is contained in:
debris
2016-02-10 22:36:59 +01:00
parent df0fa06e8a
commit 93975be5e3
4 changed files with 40 additions and 5 deletions

View File

@@ -80,7 +80,9 @@ impl TestBlockChainClient {
fn block_hash(&self, id: BlockId) -> Option<H256> {
match id {
BlockId::Hash(hash) => Some(hash),
BlockId::Number(n) => self.numbers.read().unwrap().get(&(n as usize)).cloned()
BlockId::Number(n) => self.numbers.read().unwrap().get(&(n as usize)).cloned(),
BlockId::Earliest => self.numbers.read().unwrap().get(&0).cloned(),
BlockId::Latest => self.numbers.read().unwrap().get(&(self.numbers.read().unwrap().len() - 1)).cloned()
}
}
}