Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #80
(Still missing some documentation, examples and copyright notice on the package.)
This introduces a new package called
chainscan
. The primary goal for this package is to be able to perform historical and tip-changed-triggered scans of blocks to determine whether they have relevant transactions for the LN node and retrieve the ones that are.This is an improvement over the existing manual rescan performed by the the dcrd node via LoadTxFilter as done today in dcrlnd in that it checks the cfilters for the wanted targets before attempting to iterate over the block's transactions.
It is also a necessary step towards supporting SPV mode, given that in that mode the LN node does not have access to a full chain.
The package is self-contained and has minimal external dependencies. The implemented scanners (
Historical
andTipWatcher
) require that the caller provide implementations for the chain operations necessary for the search to happen, so this package is usable by callers retrieving their information from a running dcrd instance, a dcrwallet instance or from some other source of blockchain data. This makes it suitable for use by software other than dcrlnd.A set of tests and benchmarks is included.