fix(send): prefix shielded-send memos with "utf8:" so the daemon accepts them

A shielded send with a memo failed: "Invalid parameter, expected memo data in
hexadecimal format or to use 'utf8:' prefix." The Send-tab path (and its fee-gap
retry) put the user's plain-text memo straight into the z_sendmany recipient,
which the daemon now rejects — it wants the memo hex-encoded or with a "utf8:"
prefix. The chat path already prefixes with "utf8:"; do the same for user memos.

Only the RPC recipient["memo"] is prefixed; the raw memo is still what's stored
for the transaction-history display, and the daemon returns the decoded memoStr
to receivers, so it round-trips as plain text.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-13 15:49:09 -05:00
parent 08aed34bbe
commit 13b225d8f5

View File

@@ -5062,7 +5062,10 @@ void App::sendTransaction(const std::string& from, const std::string& to,
recipient["address"] = to; recipient["address"] = to;
recipient["amount"] = util::formatAmountFixed(amount); recipient["amount"] = util::formatAmountFixed(amount);
if (!memo.empty()) { if (!memo.empty()) {
recipient["memo"] = memo; // The daemon rejects a raw memo — it wants hex or a "utf8:" prefix. Prefix the user's plain-text
// memo so it's UTF-8-encoded into the note (same as the chat path). The unprefixed `memo` is still
// passed to submitZSendMany below for the tx-history display.
recipient["memo"] = "utf8:" + memo;
} }
recipients.push_back(recipient); recipients.push_back(recipient);
@@ -5206,7 +5209,7 @@ void App::resendWithFeeGapWorkaround(const std::string& from, const std::string&
nlohmann::json primary; nlohmann::json primary;
primary["address"] = to; primary["address"] = to;
primary["amount"] = util::formatAmountFixed(amount); primary["amount"] = util::formatAmountFixed(amount);
if (!memo.empty()) primary["memo"] = memo; if (!memo.empty()) primary["memo"] = "utf8:" + memo; // daemon needs hex or a "utf8:" prefix (see submit)
recipients.push_back(primary); recipients.push_back(primary);
nlohmann::json selfOut; nlohmann::json selfOut;
selfOut["address"] = from; selfOut["address"] = from;