lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
900 stars 183 forks source link

neutrino: support utxo scanner progress. #198

Closed roeierez closed 4 years ago

roeierez commented 4 years ago

This PR suggests to add progress notifications to the utxo scanning process. Currently the caller only gets feedback at the end of the process where it can be sometimes very long. Besides the feedback there is a need to be able to start the scanning from the last point it has stopped. This is achieved in LND, for example, by using a "SpendHint" cache but it only updates the cache at the end of the process which creates a problem for mobile users that don't open their app for several weeks. The utxo scanning at this case is likely to be longer than the time their app will be online resulting in scanning all over again on every restart. This addition will enable LND to update the hint cache during the scanning progress resulting in better incremental rescan between restarts.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.4%) to 71.377% when pulling 296f485675abe26f30c3a86af78ce29e79428a7e on breez:utxo-scanner-notifications into bffc52e8f2003329ea2817b3564f64779ff12e65 on lightninglabs:master.

Roasbeef commented 4 years ago

Is there meant to be a PR to lnd that exposes this information? Otherwise as is, it's dead code.

Roasbeef commented 4 years ago

This addition will enable LND to update the hint cache during the scanning progress resulting in better incremental rescan between restarts.

Will this be made as a follow up PR?

roeierez commented 4 years ago

Will this be made as a follow up PR?

Yes, I actually have it almost ready.

roeierez commented 4 years ago

Looks good! Last missing piece is to add/modify existing unit test to check that the progess callback works as expected 👍

Tests updated.