Better error message when sending to both sprout and sapling
Co-authored-by mdr0id <marshall@z.cash>
This commit is contained in:
@@ -3687,6 +3687,9 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
||||
std::vector<SendManyRecipient> zaddrRecipients;
|
||||
CAmount nTotalOut = 0;
|
||||
|
||||
bool containsSproutOutput = false;
|
||||
bool containsSaplingOutput = false;
|
||||
|
||||
for (const UniValue& o : outputs.getValues()) {
|
||||
if (!o.isObject())
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object");
|
||||
@@ -3710,6 +3713,16 @@ UniValue z_sendmany(const UniValue& params, bool fHelp)
|
||||
bool toSprout = !toSapling;
|
||||
noSproutAddrs = noSproutAddrs && toSapling;
|
||||
|
||||
containsSproutOutput |= toSprout;
|
||||
containsSaplingOutput |= toSapling;
|
||||
|
||||
// Sending to both Sprout and Sapling is currently unsupported using z_sendmany
|
||||
if (containsSproutOutput && containsSaplingOutput) {
|
||||
throw JSONRPCError(
|
||||
RPC_INVALID_PARAMETER,
|
||||
"Cannot send to both Sprout and Sapling addresses using z_sendmany");
|
||||
}
|
||||
|
||||
// If we are sending from a shielded address, all recipient
|
||||
// shielded addresses must be of the same type.
|
||||
if (fromSprout && toSapling) {
|
||||
|
||||
Reference in New Issue
Block a user