mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Allow move RPC to take account balances negative
Use case: Customer owes you bitcoins, so you create a payment address associated with an account with a negative balance (the amount they owe). When customer pays, that account balance will go to zero.
This commit is contained in:
parent
e8adcf88cd
commit
832fb114a7
15
src/rpc.cpp
15
src/rpc.cpp
@ -702,21 +702,6 @@ Value movecmd(const Array& params, bool fHelp)
|
|||||||
CWalletDB walletdb;
|
CWalletDB walletdb;
|
||||||
walletdb.TxnBegin();
|
walletdb.TxnBegin();
|
||||||
|
|
||||||
// Check funds
|
|
||||||
if (!strFrom.empty())
|
|
||||||
{
|
|
||||||
int64 nBalance = GetAccountBalance(walletdb, strFrom, nMinDepth);
|
|
||||||
if (nAmount > nBalance)
|
|
||||||
throw JSONRPCError(-6, "Account has insufficient funds");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// move from "" account special case
|
|
||||||
int64 nBalance = GetAccountBalance(walletdb, strTo, nMinDepth);
|
|
||||||
if (nAmount > GetBalance() - nBalance)
|
|
||||||
throw JSONRPCError(-6, "Account has insufficient funds");
|
|
||||||
}
|
|
||||||
|
|
||||||
int64 nNow = GetAdjustedTime();
|
int64 nNow = GetAdjustedTime();
|
||||||
|
|
||||||
// Debit
|
// Debit
|
||||||
|
Loading…
Reference in New Issue
Block a user