mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
CreateTransaction: return strFailReason on failure
This commit is contained in:
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user