Expand description
§Bitcoin Blockchain
This module provides the structures and functions to maintain the blockchain.
Structs§
- Block
Iter - An iterator over blocks in blockheight order
- Blockchain
- The blockchain
- Blockchain
Node - A link in the blockchain
- RevBlock
Iter - An iterator over blocks in reverse blockheight order. Note that this
is essentially the same as if we’d implemented
DoubleEndedIterator
onBlockIter
— but we can’t do that since ifBlockIter
is started off the main chain, it will not reach the best tip, so the iterator and its.rev()
would be iterators over different chains! To avoid this suprising behaviour we simply use separate iterators. - RevStale
Block Iter - An iterator over blocks in reverse blockheight order, which yielding only
stale blocks (ending at the point where it would’ve returned a block on
the main chain). It does this by checking if the
next
pointer of the next-to-by-yielded block matches the currently-yielded block. If not, scan forward from next-to-be-yielded block. If we hit the best tip, set the next-to-by-yielded block to None instead.