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 committed 2022-10-25 15:57:38 +02:00
1 parent 935c6c4b23
commit 3449880b49
3 files changed
+14 -4

No files matched your search

+3
View File
@@ -181,6 +181,7 @@ const CLogCategoryDesc LogCategories[] =
{BCLog::UTIL, "util"}, {BCLog::UTIL, "util"},
{BCLog::BLOCKSTORE, "blockstorage"}, {BCLog::BLOCKSTORE, "blockstorage"},
{BCLog::TXRECONCILIATION, "txreconciliation"}, {BCLog::TXRECONCILIATION, "txreconciliation"},
{BCLog::SCAN, "scan"},
{BCLog::ALL, "1"}, {BCLog::ALL, "1"},
{BCLog::ALL, "all"}, {BCLog::ALL, "all"},
}; };
@@ -283,6 +284,8 @@ std::string LogCategoryToStr(BCLog::LogFlags category)
return "blockstorage"; return "blockstorage";
case BCLog::LogFlags::TXRECONCILIATION: case BCLog::LogFlags::TXRECONCILIATION:
return "txreconciliation"; return "txreconciliation";
case BCLog::LogFlags::SCAN:
return "scan";
case BCLog::LogFlags::ALL: case BCLog::LogFlags::ALL:
return "all"; return "all";
} }
+1
View File
@@ -67,6 +67,7 @@ namespace BCLog {
UTIL = (1 << 25), UTIL = (1 << 25),
BLOCKSTORE = (1 << 26), BLOCKSTORE = (1 << 26),
TXRECONCILIATION = (1 << 27), TXRECONCILIATION = (1 << 27),
SCAN = (1 << 28),
ALL = ~(uint32_t)0, ALL = ~(uint32_t)0,
}; };
enum class Level { enum class Level {
+10 -4
View File
@@ -1849,10 +1849,16 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
if (fast_rescan_filter) { if (fast_rescan_filter) {
fast_rescan_filter->UpdateIfNeeded(); fast_rescan_filter->UpdateIfNeeded();
auto matches_block{fast_rescan_filter->MatchesBlock(block_hash)}; auto matches_block{fast_rescan_filter->MatchesBlock(block_hash)};
if (matches_block.has_value() && !*matches_block) { if (matches_block.has_value()) {
result.last_scanned_block = block_hash; if (*matches_block) {
result.last_scanned_height = block_height; LogPrint(BCLog::SCAN, "Fast rescan: inspect block %d [%s] (filter matched)\n", block_height, block_hash.ToString());
fetch_block = false; } 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());
} }
} }