librustzcash
librustzcash copied to clipboard
zcash_client_backend: Make it possible to skip trial-decryption with internal keys.
Since internal keys should only ever receive funds that are being sent by the wallet, it should be possible to skip trial-decryption using the internal IVK for any block except those where a spend (either of a shielded note or a transparent UTXO) is detected.
This doesn't work reliably now that we are doing non-linear scanning; we don't detect spends for reverse scanning until after we've done trial decryption of the transactions they were spent in. We should still consider doing it where we do detect a spend during forward linear scanning.
I guess that we could start by just applying this optimization by checking whether the batch we're working on starts at the block above the fully-scanned height; it would give us a 2x improvement for our current approach to scanning big Historic
ranges.