dcrd/blockchain/internal
Dave Collins eea386e4e9
blockchain: Implement v2 block filter storage.
This modifies the chain logic to create and store version 2 block
filters for all new blocks and also adds code to migrate the database to
retroactively create and store the v2 filters for all historical blocks.

Since this requires a database upgrade and the next release of the
software will include a vote to change the consensus rules, this also
takes the opportunity to unmark all blocks previously marked as having
failed validation so they are eligible for validation again under what
will likely become new consensus rules.  This ensures clients that did
not update prior to new rules activating are able to automatically
recover under the new rules without having to download the entire chain
again.

The following is a high level overview of the changes:

- Introduce a new database bucket to house v2 block filters
- Make UtxoViewpoint satisfy the PrevScripter interface so it may be
  used as a source previous scripts when creating filters
- Create and store the new filters in the db when connecting blocks
- Introduce exported function named FilterByBlockHash to retrieve the
  new block filters so they are available to be served in the future
- Implement database migration code to retroactively create the new
  filters for all historical blocks
  - Bump the chain database version to 6
  - Introduce code to allow spent txout entries from the spend journal
    to be used as a source of previous scripts to significantly optimize
    the filter creation as compared to what would be required to
    reconstruct all the utxo views as of each block
  - Mark all blocks that failed validation under the current consensus
    rules as eligible for validation again
- Export a new constant named HeaderCmtFilterIndex which indicates the
  header proof index for the upcoming filter header commitment
2019-10-12 12:05:59 -05:00
..
dbnamespace blockchain: Implement v2 block filter storage. 2019-10-12 12:05:59 -05:00
progresslog blockchain: Reverse utxo set semantics. 2018-11-09 17:23:46 -06:00