Files
ObsidianDragon/src/ui/windows/console_tab_helpers.h
T
DanSandClaude Opus 5.5 16e0ee9947 perf: stop per-frame SQLite writes and console spam, make perf.log opt-in
- Explorer: the tip check runs every frame the Explorer tab is open,
  and it read both tip rows and rewrote them each time (two autocommit
  WAL writes per frame). A steady tip is now kept in memory and skips
  SQLite. A new tip writes both rows in one savepoint, so a crash
  between them can't pair a new height with the old hash. A test
  checks that 100 steady checks write nothing.
- Console: while the daemon was in the Error state the Console tab
  added its error line on every poll, i.e. every frame, re-laying out
  the whole buffer each time. It prints once per error now: on entering
  Error, when the message changes, or after another crash
  (EmbeddedDaemon::getUnexpectedExitCount(), never reset). setState
  writes the message before the state, so a reader that sees Error sees
  that error's message. The stray " ===" suffix is gone.
- perf.log: the profiler appended a block every 300 frames on every
  run and never rotated the file (tens of MB a day for a wallet left
  open). It is now off unless the app starts with DRAGONX_PERFLOG=1;
  otherwise its zone hooks are near no-ops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 19:52:09 -05:00

38 lines
1.8 KiB
C++

#pragma once
#include <string>
namespace dragonx {
namespace ui {
float ComputeConsoleInputHeight(float frameHeightWithSpacing,
float itemSpacingY,
float spacingSm,
float spacingXs,
float cursorOffset);
float ComputeConsoleOutputHeight(float availableHeight,
float inputHeight,
float minHeight,
float minHeightRatio);
float ClampConsoleWrapWidth(float contentWidth, float paddingX);
// The console's daemon-error line prints once per error: on entering the Error state, when the
// reason changes while still in it, or when the daemon crashed again meanwhile (the console only polls
// while its tab is shown, so it can miss the Running state between two identical crashes). It used to
// print on every poll, i.e. every frame, while in Error.
bool ShouldPrintDaemonErrorLine(bool wasError, bool isError,
const std::string& error, const std::string& lastPrinted,
bool newUnexpectedExit = false);
// True if `cmd`'s first token names a console/RPC command that carries a SECRET on its command line
// (passphrase, private/spending/viewing key, mnemonic). Output-secret commands (dumpprivkey,
// z_exportkey, z_exportmnemonic) are NOT covered — their secret is in the result, a separate concern.
bool ConsoleCommandCarriesSecret(const std::string& cmd);
// A display/history-safe copy of `cmd`: the command name with its arguments replaced by "****" when
// it carries a secret, else `cmd` unchanged. The real command is still executed unredacted.
std::string RedactConsoleCommand(const std::string& cmd);
} // namespace ui
} // namespace dragonx