1 suggestion
Optional improvements
[suggestion] · The scripted-diff changes output for arguments ending in a newline
For an argument ending in \n, this scripted-diff changes emitted log output from escaping that byte to dropping it; no current caller producing such an argument was identified.
Location: src/noui.cpp:29 (head).
Details and suggested fix
Logger::Format still removes exactly one trailing newline before calling LogEscapeMessage. For a non-SECURE noui error with message.original equal to "x\n", the base call formats "x\n\n" and emits [error] x\x0a; the new call formats "x\n" and emits [error] x. The separate stderr output is unchanged. This is consistent with existing bare-%s logging calls, rather than a correctness defect, but it makes the cleanup not strictly output-neutral. Document this edge case in the commit message, or add a formatter-level test with a trailing-newline argument to make the behavior choice explicit. The existing test_LogEscapeMessage bypasses suffix removal, and the inspected formatter tests use messages without trailing newlines.
Background
Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.
Documented decisions
Newline escaping was introduced to prevent untrusted input from forging apparent node-generated log lines.
The historical proposal identifies restricted RPC method names and wallet names as injection paths. This explains why payload newlines are represented as escaped bytes rather than allowed to create physical log lines; preserving a payload newline here means preserving its escaped representation.