From 10d1b9098781b92432f3e0771ed57d19d6eab1c1 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 24 Oct 2016 07:59:32 -0700 Subject: [PATCH 1/2] Fix incorrect error message in z_sendmany --- src/wallet/asyncrpcoperation_sendmany.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index eaa245857..de3ee1077 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -197,11 +197,11 @@ bool AsyncRPCOperation_sendmany::main_impl() { CAmount targetAmount = sendAmount + minersFee; if (isfromtaddr_ && (t_inputs_total < targetAmount)) { - throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strprintf("Insufficient transparent funds, have %ld, need %ld plus fee %ld", t_inputs_total, t_outputs_total, minersFee)); + throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strprintf("Insufficient transparent funds, have %ld, need %ld", t_inputs_total, targetAmount)); } if (isfromzaddr_ && (z_inputs_total < targetAmount)) { - throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strprintf("Insufficient protected funds, have %ld, need %ld plus fee %ld", z_inputs_total, z_outputs_total, minersFee)); + throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strprintf("Insufficient protected funds, have %ld, need %ld", z_inputs_total, targetAmount)); } // If from address is a taddr, select UTXOs to spend From ad0ba9467d6c248842ad4734a1f9bca5c7d84e10 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 25 Oct 2016 11:25:05 -0700 Subject: [PATCH 2/2] Add assert to AsyncRPCOperation_sendmany --- src/wallet/asyncrpcoperation_sendmany.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wallet/asyncrpcoperation_sendmany.cpp b/src/wallet/asyncrpcoperation_sendmany.cpp index de3ee1077..880555b19 100644 --- a/src/wallet/asyncrpcoperation_sendmany.cpp +++ b/src/wallet/asyncrpcoperation_sendmany.cpp @@ -196,6 +196,9 @@ bool AsyncRPCOperation_sendmany::main_impl() { CAmount sendAmount = z_outputs_total + t_outputs_total; CAmount targetAmount = sendAmount + minersFee; + assert(!isfromtaddr_ || z_inputs_total == 0); + assert(!isfromzaddr_ || t_inputs_total == 0); + if (isfromtaddr_ && (t_inputs_total < targetAmount)) { throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strprintf("Insufficient transparent funds, have %ld, need %ld", t_inputs_total, targetAmount)); }