Page MenuHomePhabricator

Improve wallet rescan API
ClosedPublic

Authored by deadalnix on Sep 6 2018, 14:04.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable