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.
This PR intends to do a complete rework of the role of sp-client in regards to the callers of the library (e.g. Dana wallet).
Sp Client
Rework Sp-client to be a thin wrapper around rust-silentpayments. Sp-client only contains the bare minimum to operate a wallet: A scan key (private), a spend key (public/private), and the current bitcoin network.
Updater
Add a 'Updater' trait. This trait tells the caller that a certain persistent operation should be handled (e.g. 'mark this transaction mined').
ChainBackend
Add a 'ChainBackend' trait. This trait is called whenever chain data is required. For example, 'get utxos from this block'.
We also add a 'BlindbitBackend', which implements the ChainBackend trait. The BlindbitBackend is behind the optional 'blindbit-backend' feature.
Sp Scanner
Finally, there is the Sp Scanner. This is a new struct that goes along with the Sp client. The Sp Scanner takes a Sp-client, along with a boxed ChainBackend and Updater.
The scanner has a
scan_blocks
function, that takes a range and will scan the blocks for transactions. SpScanner requests block/utxo data from the ChainBackend. Whenever a new output is found, it calls 'updater.record_block_outputs', with the found outputs. The caller is then responsible for recording these outputs in their persistent storage.Note
The trait definitions are very primitive, and they are clearly written around the blindbit model. The trait definitions should therefore not be considered final, but rather a starting point to be iterated on later.