Open vicentevieytes opened 1 month ago
We should be able to fetch blocks by their hash, like we do with transactions in get_transactions_by_hash.
get_transactions_by_hash
The hash can be computed with the compute_block_hash method of BlockHeader:
compute_block_hash
BlockHeader
impl BlockHeader { pub fn compute_block_hash(&self) -> H256 { let mut buf = vec![]; self.encode(&mut buf); keccak(buf) }
We should have 3 tables:
Headers: height|hash => rpl(block) CanonicalHeaders: height => hash HeaderNumber hash => height
We should be able to fetch blocks by their hash, like we do with transactions in
get_transactions_by_hash
.The hash can be computed with the
compute_block_hash
method ofBlockHeader
: