wallet: fast rescan: show log message for every non-skipped block

For that purpose, a new logging category BCLog::SCAN is introduced.
This commit is contained in:
Sebastian Falbesoner
2022-10-01 12:23:59 +02:00
parent 935c6c4b23
commit 3449880b49
3 changed files with 14 additions and 4 deletions

View File

@@ -181,6 +181,7 @@ const CLogCategoryDesc LogCategories[] =
{BCLog::UTIL, "util"},
{BCLog::BLOCKSTORE, "blockstorage"},
{BCLog::TXRECONCILIATION, "txreconciliation"},
{BCLog::SCAN, "scan"},
{BCLog::ALL, "1"},
{BCLog::ALL, "all"},
};
@@ -283,6 +284,8 @@ std::string LogCategoryToStr(BCLog::LogFlags category)
return "blockstorage";
case BCLog::LogFlags::TXRECONCILIATION:
return "txreconciliation";
case BCLog::LogFlags::SCAN:
return "scan";
case BCLog::LogFlags::ALL:
return "all";
}

View File

@@ -67,6 +67,7 @@ namespace BCLog {
UTIL = (1 << 25),
BLOCKSTORE = (1 << 26),
TXRECONCILIATION = (1 << 27),
SCAN = (1 << 28),
ALL = ~(uint32_t)0,
};
enum class Level {

View File

@@ -1849,11 +1849,17 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
if (fast_rescan_filter) {
fast_rescan_filter->UpdateIfNeeded();
auto matches_block{fast_rescan_filter->MatchesBlock(block_hash)};
if (matches_block.has_value() && !*matches_block) {
if (matches_block.has_value()) {
if (*matches_block) {
LogPrint(BCLog::SCAN, "Fast rescan: inspect block %d [%s] (filter matched)\n", block_height, block_hash.ToString());
} else {
result.last_scanned_block = block_hash;
result.last_scanned_height = block_height;
fetch_block = false;
}
} else {
LogPrint(BCLog::SCAN, "Fast rescan: inspect block %d [%s] (WARNING: block filter not found!)\n", block_height, block_hash.ToString());
}
}
// Find next block separately from reading data above, because reading