Decode utf8 in opreturn and convert to hex
This commit is contained in:
@@ -5157,9 +5157,14 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
if(params.size() == 5) {
|
if(params.size() == 5) {
|
||||||
opretValue = params[4].get_str();
|
opretValue = params[4].get_str();
|
||||||
|
|
||||||
|
// Support a prefix "utf8:" which allows giving utf8 text instead of hex
|
||||||
if(opretValue.get_str().substr(0,5) == "utf8:") {
|
if(opretValue.get_str().substr(0,5) == "utf8:") {
|
||||||
// TODO: 1) remove the first 5 chars
|
auto str = opretValue.get_str().substr(5);
|
||||||
// 2) convert remaining text to hex and store in opretValue
|
if (utf8::is_valid(str)) {
|
||||||
|
opretValue = HexStr(str);
|
||||||
|
} else {
|
||||||
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid utf8 in opreturn");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user