From ca9fc49fc4a27a6b0117dfff3e6b0b6769461ab2 Mon Sep 17 00:00:00 2001 From: furszy Date: Sun, 1 Nov 2020 12:08:04 -0300 Subject: [PATCH] rpc_wallet_tests: changed "Insufficient funds" error message to a proper "Insufficient transparent funds". This is because we are now throwing the insufficient transparent balance rpc error inside load_utxo. --- qa/rpc-tests/wallet_shieldingcoinbase.py | 2 +- src/wallet/asyncrpcoperation_sendmany.cpp | 3 ++- src/wallet/test/rpc_wallet_tests.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qa/rpc-tests/wallet_shieldingcoinbase.py b/qa/rpc-tests/wallet_shieldingcoinbase.py index 910cec65c..98e4e1a7a 100755 --- a/qa/rpc-tests/wallet_shieldingcoinbase.py +++ b/qa/rpc-tests/wallet_shieldingcoinbase.py @@ -84,7 +84,7 @@ class WalletShieldingCoinbaseTest (BitcoinTestFramework): recipients= [{"address":myzaddr, "amount": Decimal('1')}] myopid = self.nodes[3].z_sendmany(mytaddr, recipients) - wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "Insufficient funds, no UTXOs found for taddr from address.", 10) + wait_and_assert_operationid_status(self.nodes[3], myopid, "failed", "Insufficient transparent funds, no UTXOs found for taddr from address.", 10) # This send will fail because our wallet does not allow any change when shielding a coinbase utxo, # as it's currently not possible to specify a change address in z_sendmany. diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index 67f2c9bc6..cd67797fd 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -240,7 +240,7 @@ bool AsyncRPCOperation_sendmany::main_impl() { if (!useanyutxo_ && isSingleZaddrOutput) { bool b = find_utxos(true, txValues); if (!b) { - throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds, no UTXOs found for taddr from address."); + throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient transparent funds, no UTXOs found for taddr from address."); } } else { bool b = find_utxos(false, txValues); @@ -851,6 +851,7 @@ bool AsyncRPCOperation_sendmany::find_utxos(bool fAcceptCoinbase, TxValues& txVa true, // fOnlySpendable mindepth_, // nMinDepth &destinations); // onlyFilterByDests + if (t_inputs_.empty()) return false; // sort in ascending order, so smaller utxos appear first std::sort(t_inputs_.begin(), t_inputs_.end(), [](const COutput& i, const COutput& j) -> bool { diff --git a/src/wallet/test/rpc_wallet_tests.cpp b/src/wallet/test/rpc_wallet_tests.cpp index 282dc1b15..3e2989356 100644 --- a/src/wallet/test/rpc_wallet_tests.cpp +++ b/src/wallet/test/rpc_wallet_tests.cpp @@ -1209,7 +1209,7 @@ BOOST_AUTO_TEST_CASE(rpc_z_sendmany_internals) operation->main(); BOOST_CHECK(operation->isFailed()); std::string msg = operation->getErrorMessage(); - BOOST_CHECK( msg.find("Insufficient funds, no UTXOs found") != string::npos); + BOOST_CHECK( msg.find("Insufficient transparent funds") != string::npos); } // minconf cannot be zero when sending from zaddr