If a wallet has key birthdates that are more recent than the currrent chain tip, or a bestblock height higher than the current tip, we should not attempt to rescan as there is nothing to scan for.
Fixes #26655
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Approach ACK
3193 | + } 3194 | + if (time_first_key) { 3195 | + FoundBlock found = FoundBlock().height(rescan_height); 3196 | + chain.findFirstBlockWithTimeAndHeight(*time_first_key - TIMESTAMP_WINDOW, rescan_height, found); 3197 | + if (!found.found) { 3198 | + // We were unable to find a block a block that had a time more recent than our earliest timestamp
nit:
// We were unable to find a block that had a time more recent than our earliest timestamp
Done
utACK 57f8f618f47526205e515b5ee8f9ab2f1eb625cd
If a wallet has key birthdates that are more recent than the currrent
chain tip, or a bestblock height higher than the current tip, we should
not attempt to rescan as there is nothing to scan for.
re-utACK 378400953424598fd78ccec5ba8cc38bc253c550
utACK https://github.com/bitcoin/bitcoin/pull/26679/commits/378400953424598fd78ccec5ba8cc38bc253c550
Ci error seems unrelated.
3190 | + for (auto spk_man : walletInstance->GetAllScriptPubKeyMans()) { 3191 | + int64_t time = spk_man->GetTimeFirstKey(); 3192 | + if (!time_first_key || time < *time_first_key) time_first_key = time; 3193 | + } 3194 | + if (time_first_key) { 3195 | + FoundBlock found = FoundBlock().height(rescan_height);
what is the reason behind the height set here? It doesn't seems to be used anywhere inside findFirstBlockWithTimeAndHeight nor below.
It is used in ScanForWalletTransactions, below?
yeah ok, digested it now. thanks. Was expecting FoundBlock to be an inputs-only container when it's actually the outputs container.
Code review ACK 37840095 A test covering the existent failure would be nice too.