util: make ReplaceAll literal

`ReplaceAll()` substitutes fixed tokens in notification commands and other strings.
PR #25803 replaced the Boost helper with `std::regex_replace()`, treating searches as regular expressions and substitutes as replacement-format syntax.

Restore literal, non-recursive replacement so callers match fixed tokens and preserve replacement bytes exactly, while avoiding a new string when the search text is absent.

Co-authored-by: Rob Hamilton <6456095+Rob1Ham@users.noreply.github.com>
This commit is contained in:
Lőrinc
2026-08-15 12:11:51 -07:00
parent 604d7e8fdd
commit 469b0e59a2
4 changed files with 18 additions and 6 deletions

View File

@@ -186,8 +186,8 @@ class NotificationsTest(BitcoinTestFramework):
self.sync_mempools()
notify_path = os.path.join(self.walletnotify_dir, notify_outputname(wallet_name, txid))
self.wait_until(lambda: os.path.exists(command_marker) or os.path.exists(notify_path), timeout=10)
assert os.path.exists(command_marker) # TODO: Wallet names must not inject shell commands.
assert not os.path.exists(notify_path) # TODO: Wallet names must remain literal in notification paths.
assert not os.path.exists(command_marker)
assert os.path.exists(notify_path)
self.log.info("test -alertnotify with large work invalid chain")
# create a bunch of invalid blocks