From 1f00f4e9c9b4b643da22bb5d9f94d66683fa1a15 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 25 Apr 2013 17:31:22 -0400 Subject: CreateTransaction: return strFailReason on failure --- src/rpcwallet.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/rpcwallet.cpp') diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 9a899f9238..5fd400c6bb 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -694,13 +694,10 @@ Value sendmany(const Array& params, bool fHelp) // Send CReserveKey keyChange(pwalletMain); int64 nFeeRequired = 0; - bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired); + string strFailReason; + bool fCreated = pwalletMain->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, strFailReason); if (!fCreated) - { - if (totalAmount + nFeeRequired > pwalletMain->GetBalance()) - throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds"); - throw JSONRPCError(RPC_WALLET_ERROR, "Transaction creation failed"); - } + throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); if (!pwalletMain->CommitTransaction(wtx, keyChange)) throw JSONRPCError(RPC_WALLET_ERROR, "Transaction commit failed"); -- cgit v1.2.3