Struct ckb_types::packed::BlockReader [−][src]
pub struct BlockReader<'r>(_);
Implementations
Calls HeaderReader.calc_header_hash()
for self.header()
.
Calculates the hash for the extension.
If there is an extension (unknown for now), calculate the hash of its data.
Calculates the extra hash, which is a combination of the uncles hash and the extension hash.
- If there is no extension, extra hash is the same as the uncles hash.
- If there is a extension, then extra hash it the hash of the combination of uncles hash and the extension hash.
Calculates transaction hashes for all transactions in the block.
Calculates transaction witness hashes for all transactions in the block.
Calculates the serialized size of Block
without uncle proposals.
Computational Steps
- Calculates the total serialized size of
Block
, marks it asB
. - Calculates the serialized size
ProposalShortIdVec
for each uncle block, marks them asP0, P1, ..., Pn
. - Even an uncle has no proposals, the
ProposalShortIdVec
still has a header contains its total size, the size ismolecule::NUMBER_SIZE
, marks it ash
. - So the serialized size of
Block
without uncle proposals is:B - sum(P0 - h, P1 - h, ..., Pn - h)
Gets the i-th extra field if it exists; i started from 0.
Gets the extension field if it existed.
Panics
Panics if the first extra field exists but not a valid BytesReader
.
Trait Implementations
Auto Trait Implementations
impl<'r> RefUnwindSafe for BlockReader<'r>
impl<'r> Send for BlockReader<'r>
impl<'r> Sync for BlockReader<'r>
impl<'r> Unpin for BlockReader<'r>
impl<'r> UnwindSafe for BlockReader<'r>
Blanket Implementations
Mutably borrows from an owned value. Read more
Unwraps the result of from_slice(..)
with confidence and we assume that it’s impossible to fail.