Don't let people send more XRP than they have.

This commit is contained in:
Arthur Britto
2013-03-13 22:14:24 -07:00
parent 7bd96e9f2f
commit 91f7bab7e4
2 changed files with 10 additions and 3 deletions

View File

@@ -1383,8 +1383,15 @@ TER LedgerEntrySet::accountSend(const uint160& uSenderID, const uint160& uReceiv
if (sleSender)
{
sleSender->setFieldAmount(sfBalance, sleSender->getFieldAmount(sfBalance) - saAmount);
entryModify(sleSender);
if (sleSender->getFieldAmount(sfBalance) < saAmount)
{
terResult = isSetBit(mParams, tapOPEN_LEDGER) ? telFAILED_PROCESSING : tecFAILED_PROCESSING;
}
else
{
sleSender->setFieldAmount(sfBalance, sleSender->getFieldAmount(sfBalance) - saAmount);
entryModify(sleSender);
}
}
if (sleReceiver)

View File

@@ -2322,7 +2322,7 @@ TER RippleCalc::calcNodeAccountFwd(
saCurDeliverAct = std::min(saCurDeliverAct, psCur.saInReq-psCur.saInAct);
// Limit XRP by available. No limit for non-XRP as issuer.
if (!uCurAccountID)
if (!uCurrencyID)
saCurDeliverAct = std::min(saCurDeliverAct, lesActive.accountHolds(uCurAccountID, CURRENCY_XRP, ACCOUNT_XRP));
}