pub struct CheckPoint(_);
Expand description

A LocalChain checkpoint is used to find the agreement point between two chains and as a transaction anchor.

Each checkpoint contains the height and hash of a block (BlockId).

Internally, checkpoints are nodes of a reference-counted linked-list. This allows the caller to cheaply clone a CheckPoint without copying the whole list and to view the entire chain without holding a lock on LocalChain.


Construct a new base block at the front of a linked list.

Construct a checkpoint from a list of BlockIds in ascending height order.


This method will error if any of the follow occurs:

  • The blocks iterator is empty, in which case, the error will be None.
  • The blocks iterator is not in ascending height order.
  • The blocks iterator contains multiple BlockIds of the same height.

The error type is the last successful checkpoint constructed (if any).

Construct a checkpoint from the given header and block height.

If header is of the genesis block, the checkpoint won’t have a prev node. Otherwise, we return a checkpoint linked with the previous block.

Puts another checkpoint onto the linked list representing the blockchain.

Returns an Err(self) if the block you are pushing on is not at a greater height that the one you are pushing on to.

Extends the checkpoint linked list by a iterator of block ids.

Returns an Err(self) if there is block which does not have a greater height than the previous one.

Get the BlockId of the checkpoint.

Get the height of the checkpoint.

Get the block hash of the checkpoint.

Get the previous checkpoint in the chain

Iterate from this checkpoint in descending height.

Get checkpoint at height.

Returns None if checkpoint at height does not exist`.

Iterate checkpoints over a height range.

Note that we always iterate checkpoints in reverse height order (iteration starts at tip height).

Inserts block_id at its height within the chain.

The effect of insert depends on whether a height already exists. If it doesn’t the block_id we inserted and all pre-existing blocks higher than it will be re-inserted after it. If the height already existed and has a conflicting block hash then it will be purged along with all block followin it. The returned chain will have a tip of the block_id passed in. Of course, if the block_id was already present then this just returns self.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.