[][src]Module grin_chain::txhashset

Utility structs to handle the 3 hashtrees (output, range proof, kernel) more conveniently and transactionally.

Structs

Extension

Allows the application of new blocks on top of the sum trees in a reversible manner within a unit of work provided by the extending function.

HeaderExtension

A header extension to allow the header MMR to extend beyond the other MMRs individually. This is to allow headers to be validated against the MMR before we have the full block data.

RewindableKernelView

Rewindable (but readonly) view of the kernel set (based on kernel MMR).

TxHashSet

An easy to manipulate structure holding the 3 sum trees necessary to validate blocks and capturing the Output set, the range proofs and the kernels. Also handles the index of Commitments to positions in the output and range proof pmmr trees.

UTXOView

Readonly view of the UTXO set (based on output MMR).

Functions

extending

Starts a new unit of work to extend the chain with additional blocks, accepting a closure that will work within that unit of work. The closure has access to an Extension object that allows the addition of blocks to the txhashset and the checking of the current tree roots.

extending_readonly

Starts a new unit of work to extend (or rewind) the chain with additional blocks. Accepts a closure that will operate within that unit of work. The closure has access to an Extension object that allows the addition of blocks to the txhashset and the checking of the current tree roots.

header_extending

Start a new header MMR unit of work. This MMR tracks the header_head. This MMR can be extended individually beyond the other (output, rangeproof and kernel) MMRs to allow headers to be validated before we receive the full block data.

input_pos_to_rewind

Given a block header to rewind to and the block header at the head of the current chain state, we need to calculate the positions of all inputs (spent outputs) we need to "undo" during a rewind. We do this by leveraging the "block_input_bitmap" cache and OR'ing the set of bitmaps together for the set of blocks being rewound.

rewindable_kernel_view

Rewindable (but still readonly) view on the kernel MMR. The underlying backend is readonly. But we permit the PMMR to be "rewound" via last_pos. We create a new db batch for this view and discard it (rollback) when we are done with the view.

sync_extending

Start a new sync MMR unit of work. This MMR tracks the sync_head. This is used during header sync to validate batches of headers as they arrive without needing to repeatedly rewind the header MMR that continues to track the header_head as they diverge during sync.

utxo_view

Readonly view on the UTXO set. Based on the current txhashset output_pmmr.

zip_read

Packages the txhashset data files into a zip and returns a Read to the resulting file

zip_write

Extract the txhashset data from a zip file and writes the content into the txhashset storage dir