HomePhabricator

Improve wallet rescan API

Description

Improve wallet rescan API

Summary:
This is backport of core's PR10412

  • Add RescanFromTime method and use from rpcdump

No change in behavior.

  • Move birthday optimization out of ScanForWalletTransactions

This change has no effect on wallet behavior.

On wallet startup, the transaction scan avoids reading any blocks with
timestamps older than the wallet birthday (less than nTimeFirstKey -
TIMESTAMP_WINDOW). This block skipping code currently resides in
CWallet::ScanForWalletTransactions but it doesn't really belong there because
it makes the implementation unnecessarily fragile and hard to understand, and
it never has any effect except at startup (because all other callers do their
rescans based on timestamps other than, but always greater or equal to,
nTimeFirstKey).

  • Make CWallet::RescanFromTime comment less ambiguous
  • Handle TIMESTAMP_WINDOW within CWallet::RescanFromTime

This way CWallet::RescanFromTime callers don't need to subtract
TIMESTAMP_WINDOW themselves.

This is pure refactoring, there is no change in behavior.

Test Plan:

make check
./test/functional/test_runner.py

Reviewers: #bitcoin_abc, schancel

Reviewed By: #bitcoin_abc, schancel

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1728

Details

Provenance
Russell Yanofsky <russ@yanofsky.org>Authored on Mar 2 2017, 20:24
deadalnixCommitted on Sep 10 2018, 19:52
deadalnixPushed on Sep 10 2018, 21:59
Reviewer
Restricted Project
Differential Revision
D1728: Improve wallet rescan API
Parents
rSTAGINGe8854855af09: Update seed and seed selection
Branches
Unknown
Tags
Unknown

Event Timeline