From 07d85a64559a8a95be6800f3551d199b1062d680 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Thu, 30 Aug 2018 09:42:21 +0100 Subject: [PATCH] Define additional booleans for readability --- src/wallet/rpcwallet.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e1cf19865..89719aa2d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3626,9 +3626,10 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) } // Remember whether this is a Sprout or Sapling address - // !fromTaddr && !fromSapling -> Sprout fromSapling = boost::get(&res) != nullptr; } + // This logic will need to be updated if we add a new shielded pool + bool fromSprout = !(fromTaddr || fromSapling); UniValue outputs = params[1].get_array(); @@ -3639,7 +3640,7 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) set setAddress; // Track whether we see any Sprout addresses - bool noSproutAddrs = fromTaddr || fromSapling; + bool noSproutAddrs = !fromSprout; // Recipients std::vector taddrRecipients; @@ -3666,17 +3667,18 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) isZaddr = true; bool toSapling = boost::get(&res) != nullptr; + bool toSprout = !toSapling; noSproutAddrs = noSproutAddrs && toSapling; // If we are sending from a shielded address, all recipient // shielded addresses must be of the same type. if (!fromTaddr) { - if (!fromSapling && toSapling) { + if (fromSprout && toSapling) { throw JSONRPCError( RPC_INVALID_PARAMETER, "Cannot send from a Sprout address to a Sapling address using z_sendmany"); } - if (fromSapling && !toSapling) { + if (fromSapling && toSprout) { throw JSONRPCError( RPC_INVALID_PARAMETER, "Cannot send from a Sapling address to a Sprout address using z_sendmany");