There can be only one OP_RETURN in a tx
This commit is contained in:
@@ -5021,6 +5021,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
"3. minconf (numeric, optional, default=1) Only use funds confirmed at least this many times.\n"
|
"3. minconf (numeric, optional, default=1) Only use funds confirmed at least this many times.\n"
|
||||||
"4. fee (numeric, optional, default="
|
"4. fee (numeric, optional, default="
|
||||||
+ strprintf("%s", FormatMoney(ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE)) + ") The fee amount to attach to this transaction.\n"
|
+ strprintf("%s", FormatMoney(ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE)) + ") The fee amount to attach to this transaction.\n"
|
||||||
|
"5. opreturn (string, optional) Hex encoded data for OP_RETURN.\n"
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
"\"operationid\" (string) An operationid to pass to z_getoperationstatus to get the result of the operation.\n"
|
"\"operationid\" (string) An operationid to pass to z_getoperationstatus to get the result of the operation.\n"
|
||||||
"\nExamples:\n"
|
"\nExamples:\n"
|
||||||
@@ -5152,8 +5153,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
CAmount nTotalOut = 0;
|
CAmount nTotalOut = 0;
|
||||||
// Optional OP_RETURN data
|
// Optional OP_RETURN data
|
||||||
CScript opret;
|
CScript opret;
|
||||||
// TODO: enforce that only a single opreturn exists
|
UniValue opretValue = params.size() >= 4 ? params[4].get_str() : "";
|
||||||
UniValue opretValue;
|
|
||||||
|
|
||||||
bool containsSaplingOutput = false;
|
bool containsSaplingOutput = false;
|
||||||
|
|
||||||
@@ -5164,7 +5164,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
|
|||||||
// sanity check, report error if unknown key-value pairs
|
// sanity check, report error if unknown key-value pairs
|
||||||
for (const string& name_ : o.getKeys()) {
|
for (const string& name_ : o.getKeys()) {
|
||||||
std::string s = name_;
|
std::string s = name_;
|
||||||
if (s != "address" && s != "amount" && s!="memo" && s!="opreturn") {
|
if (s != "address" && s != "amount" && s!="memo") {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, unknown key: ")+s);
|
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, unknown key: ")+s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user