mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-17 13:07:54 +02:00
CreateTransaction: return strFailReason on failure
This commit is contained in:
parent
8de9bb53af
commit
1f00f4e9c9
4 changed files with 37 additions and 17 deletions
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue