diff options
| author | Gavin Andresen <[email protected]> | 2013-04-25 17:31:22 -0400 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2013-05-03 10:54:31 -0400 |
| commit | 1f00f4e9c9b4b643da22bb5d9f94d66683fa1a15 (patch) | |
| tree | 4ab3e19ea52f1f9267d75577c875cfbf2a41bc8c /src/rpcwallet.cpp | |
| parent | Define dust transaction outputs, and make them non-standard (diff) | |
| download | discoin-1f00f4e9c9b4b643da22bb5d9f94d66683fa1a15.tar.xz discoin-1f00f4e9c9b4b643da22bb5d9f94d66683fa1a15.zip | |
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 9a899f923..5fd400c6b 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"); |