Merge #9165: SendMoney: use already-calculated balance

ea83d00 SendMoney: use already-calculated balance (instagibbs)
This commit is contained in:
Wladimir J. van der Laan 2016-12-05 12:47:23 +01:00
commit c01f16aaa0
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 1 additions and 1 deletions

View File

@ -362,7 +362,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
vecSend.push_back(recipient);
if (!pwalletMain->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet, strError)) {
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > pwalletMain->GetBalance())
if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance)
strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
throw JSONRPCError(RPC_WALLET_ERROR, strError);
}