Skip to content

Commit

Permalink
|move| command now uses [minconf] and check the balance
Browse files Browse the repository at this point in the history
  • Loading branch information
paraboul committed May 29, 2013
1 parent 09e437b commit 388ef40
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,9 @@ Value movecmd(const Array& params, bool fHelp)
string strFrom = AccountFromValue(params[0]);
string strTo = AccountFromValue(params[1]);
int64 nAmount = AmountFromValue(params[2]);
int nMinDepth = 1;
if (params.size() > 3)
// unused parameter, used to be nMinDepth, keep type-checking it though
(void)params[3].get_int();
nMinDepth = params[3].get_int();
string strComment;
if (params.size() > 4)
strComment = params[4].get_str();
Expand All @@ -574,6 +574,10 @@ Value movecmd(const Array& params, bool fHelp)
if (!walletdb.TxnBegin())
throw JSONRPCError(RPC_DATABASE_ERROR, "database error");

int64 nBalance = GetAccountBalance(strFrom, nMinDepth);
if (nAmount > nBalance)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds");

int64 nNow = GetAdjustedTime();

// Debit
Expand Down

0 comments on commit 388ef40

Please sign in to comment.