diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-04-25 17:31:22 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-05-03 10:54:31 -0400 |
commit | 1f00f4e9c9b4b643da22bb5d9f94d66683fa1a15 (patch) | |
tree | 4ab3e19ea52f1f9267d75577c875cfbf2a41bc8c /src/rpcwallet.cpp | |
parent | 8de9bb53af32f7f6b09c06f831f2c0a7b4e95303 (diff) |
CreateTransaction: return strFailReason on failure
Diffstat (limited to 'src/rpcwallet.cpp')
-rw-r--r-- | src/rpcwallet.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
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"); |