fix(sync): prioritize getblockchaininfo and pause chat scans while behind
The node kept falling behind the network near the tip because sync DETECTION was starved: getblockchaininfo was queued behind the O(mapWallet) wallet RPCs (z_gettotalbalance / z_listunspent), so longestchain went stale, the wallet decided it was "synced", and it resumed hammering cs_main — a feedback loop. - Issue getblockchaininfo FIRST each cycle and skip the balance/address/ tx refresh entirely while behind, so sync state (and kSyncProfile) updates before any heavy wallet scan runs. - Gate the two chat note scans (refreshChatNoteBudgetNode / fastScanChatMemos) on effectivelySyncing() and the active page, so chat memo scanning no longer competes with block connection during sync. - Windows debug.log tailer: reset the read offset when dragonxd truncates the log on startup (it was stranding at Block:0 with no witness/rescan progress). - Tests cover the getblockchaininfo-first ordering and behind-skip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -816,11 +816,21 @@ void EmbeddedDaemon::drainOutput()
|
||||
}
|
||||
|
||||
size_t currentSize = static_cast<size_t>(fileSize.QuadPart);
|
||||
// Truncation / rotation detection. dragonxd shrinks debug.log on startup (ShrinkDebugFile keeps
|
||||
// only the tail once it has grown large), so the file can become SMALLER than where we left off.
|
||||
// Our offset was set to the PRE-shrink size at spawn, so without this reset it stays stranded ahead
|
||||
// of the freshly-truncated file and we read NOTHING for the whole session — no block height (status
|
||||
// bar shows "Block: 0") and, worse, no witness-rebuild progress, since the "Setting Initial Sapling
|
||||
// Witness …" lines the warmup progress bar parses only exist in debug.log on Windows. On a shrink,
|
||||
// restart from the new beginning; the parser is monotonic and converges as it reaches current output.
|
||||
if (currentSize < debug_log_offset_) {
|
||||
debug_log_offset_ = 0;
|
||||
}
|
||||
if (currentSize <= debug_log_offset_) {
|
||||
CloseHandle(hFile);
|
||||
return; // No new data
|
||||
}
|
||||
|
||||
|
||||
// Seek to where we left off
|
||||
LARGE_INTEGER seekPos;
|
||||
seekPos.QuadPart = static_cast<LONGLONG>(debug_log_offset_);
|
||||
|
||||
Reference in New Issue
Block a user