diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 8d33cd1d9..fe0947a47 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5172,6 +5172,11 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk) bool containsSaplingOutput = false; + // Create the CScript representation of the OP_RETURN + if (!opretValue.isNull()) { + opret << OP_RETURN << ParseHex(opretValue.get_str().c_str()); + } + for (const UniValue& o : outputs.getValues()) { if (!o.isObject()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object"); @@ -5198,11 +5203,6 @@ UniValue z_sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk) // throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Extreme Privacy! You must send to a zaddr"); //} - // Create the CScript representation of the OP_RETURN - if (!opretValue.isNull()) { - opret << OP_RETURN << ParseHex(opretValue.get_str().c_str()); - } - UniValue memoValue = find_value(o, "memo"); string memo; if (!memoValue.isNull()) {