* Scan active chain for relevant transactions after importing keys. This should * be called whenever new keys are added to the wallet, with the oldest key * creation time. * * @return Earliest timestamp that could be successfully scanned from. Timestamp * returned will be higher than startTime if relevant blocks could not be read. */
| 1677 | * returned will be higher than startTime if relevant blocks could not be read. |
| 1678 | */ |
| 1679 | int64_t CWallet::RescanFromTime(int64_t startTime, const WalletRescanReserver& reserver, bool update) |
| 1680 | { |
| 1681 | // Find starting block. May be null if nCreateTime is greater than the |
| 1682 | // highest blockchain timestamp, in which case there is nothing that needs |
| 1683 | // to be scanned. |
| 1684 | CBlockIndex* startBlock = nullptr; |
| 1685 | { |
| 1686 | LOCK(cs_main); |
| 1687 | startBlock = chainActive.FindEarliestAtLeast(startTime - TIMESTAMP_WINDOW); |
| 1688 | WalletLogPrintf("%s: Rescanning last %i blocks\n", __func__, startBlock ? chainActive.Height() - startBlock->nHeight + 1 : 0); |
| 1689 | } |
| 1690 | |
| 1691 | if (startBlock) { |
| 1692 | const CBlockIndex* const failedBlock = ScanForWalletTransactions(startBlock, nullptr, reserver, update); |
| 1693 | if (failedBlock) { |
| 1694 | return failedBlock->GetBlockTimeMax() + TIMESTAMP_WINDOW + 1; |
| 1695 | } |
| 1696 | } |
| 1697 | return startTime; |
| 1698 | } |
| 1699 | |
| 1700 | /** |
| 1701 | * Scan the block chain (starting in pindexStart) for transactions |
no test coverage detected