Skip to content

Commit 3449880

Browse files
committed
wallet: fast rescan: show log message for every non-skipped block
For that purpose, a new logging category BCLog::SCAN is introduced.
1 parent 935c6c4 commit 3449880

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/logging.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ const CLogCategoryDesc LogCategories[] =
181181
{BCLog::UTIL, "util"},
182182
{BCLog::BLOCKSTORE, "blockstorage"},
183183
{BCLog::TXRECONCILIATION, "txreconciliation"},
184+
{BCLog::SCAN, "scan"},
184185
{BCLog::ALL, "1"},
185186
{BCLog::ALL, "all"},
186187
};
@@ -283,6 +284,8 @@ std::string LogCategoryToStr(BCLog::LogFlags category)
283284
return "blockstorage";
284285
case BCLog::LogFlags::TXRECONCILIATION:
285286
return "txreconciliation";
287+
case BCLog::LogFlags::SCAN:
288+
return "scan";
286289
case BCLog::LogFlags::ALL:
287290
return "all";
288291
}

src/logging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ namespace BCLog {
6767
UTIL = (1 << 25),
6868
BLOCKSTORE = (1 << 26),
6969
TXRECONCILIATION = (1 << 27),
70+
SCAN = (1 << 28),
7071
ALL = ~(uint32_t)0,
7172
};
7273
enum class Level {

src/wallet/wallet.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,10 +1849,16 @@ CWallet::ScanResult CWallet::ScanForWalletTransactions(const uint256& start_bloc
18491849
if (fast_rescan_filter) {
18501850
fast_rescan_filter->UpdateIfNeeded();
18511851
auto matches_block{fast_rescan_filter->MatchesBlock(block_hash)};
1852-
if (matches_block.has_value() && !*matches_block) {
1853-
result.last_scanned_block = block_hash;
1854-
result.last_scanned_height = block_height;
1855-
fetch_block = false;
1852+
if (matches_block.has_value()) {
1853+
if (*matches_block) {
1854+
LogPrint(BCLog::SCAN, "Fast rescan: inspect block %d [%s] (filter matched)\n", block_height, block_hash.ToString());
1855+
} else {
1856+
result.last_scanned_block = block_hash;
1857+
result.last_scanned_height = block_height;
1858+
fetch_block = false;
1859+
}
1860+
} else {
1861+
LogPrint(BCLog::SCAN, "Fast rescan: inspect block %d [%s] (WARNING: block filter not found!)\n", block_height, block_hash.ToString());
18561862
}
18571863
}
18581864

0 commit comments

Comments
 (0)