mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 13:35:54 +00:00
Merge branch 'master' of github.com:jedmccaleb/NewCoin
This commit is contained in:
@@ -466,7 +466,7 @@ TER OfferCreateTransactor::doApply()
|
||||
// Complete as is.
|
||||
nothing();
|
||||
}
|
||||
else if (mTxnAccount->getFieldAmount(sfBalance).getNValue() < mEngine->getLedger()->getReserve(mTxnAccount->getFieldU32(sfOwnerCount)+1))
|
||||
else if (mPriorBalance.getNValue() < mEngine->getLedger()->getReserve(mTxnAccount->getFieldU32(sfOwnerCount)+1))
|
||||
{
|
||||
if (isSetBit(mParams, tapOPEN_LEDGER)) // Ledger is not final, can vote no.
|
||||
{
|
||||
|
||||
@@ -190,24 +190,22 @@ TER PaymentTransactor::doApply()
|
||||
{
|
||||
// Direct XRP payment.
|
||||
|
||||
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||
const uint32 uOwnerCount = mTxnAccount->getFieldU32(sfOwnerCount);
|
||||
const uint64 uReserve = mEngine->getLedger()->getReserve(uOwnerCount);
|
||||
STAmount saPaid = mTxn.getTransactionFee();
|
||||
|
||||
// Make sure have enough reserve to send. Allow final spend to use reserve for fee.
|
||||
if (saSrcXRPBalance + saPaid < saDstAmount + uReserve) // Reserve is not scaled by fee.
|
||||
if (mPriorBalance < saDstAmount + uReserve) // Reserve is not scaled by fee.
|
||||
{
|
||||
// Vote no. However, transaction might succeed, if applied in a different order.
|
||||
cLog(lsINFO) << "";
|
||||
cLog(lsINFO) << boost::str(boost::format("Payment: Delay transaction: Insufficient funds: %s / %s (%d)")
|
||||
% saSrcXRPBalance.getText() % (saDstAmount + uReserve).getText() % uReserve);
|
||||
% mPriorBalance.getText() % (saDstAmount + uReserve).getText() % uReserve);
|
||||
|
||||
terResult = tecUNFUNDED_PAYMENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
mTxnAccount->setFieldAmount(sfBalance, saSrcXRPBalance - saDstAmount);
|
||||
mTxnAccount->setFieldAmount(sfBalance, mSourceBalance - saDstAmount);
|
||||
sleDst->setFieldAmount(sfBalance, sleDst->getFieldAmount(sfBalance) + saDstAmount);
|
||||
|
||||
// re-arm the password change fee if we can and need to
|
||||
|
||||
@@ -202,8 +202,9 @@ TER Transactor::apply()
|
||||
}
|
||||
else
|
||||
{
|
||||
mSourceBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||
mHasAuthKey = mTxnAccount->isFieldPresent(sfRegularKey);
|
||||
mPriorBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||
mSourceBalance = mPriorBalance;
|
||||
mHasAuthKey = mTxnAccount->isFieldPresent(sfRegularKey);
|
||||
}
|
||||
|
||||
terResult = checkSeq();
|
||||
|
||||
@@ -10,15 +10,16 @@ class Transactor
|
||||
{
|
||||
protected:
|
||||
const SerializedTransaction& mTxn;
|
||||
TransactionEngine* mEngine;
|
||||
TransactionEngineParams mParams;
|
||||
TransactionEngine* mEngine;
|
||||
TransactionEngineParams mParams;
|
||||
|
||||
uint160 mTxnAccountID;
|
||||
STAmount mFeeDue;
|
||||
STAmount mSourceBalance;
|
||||
SLE::pointer mTxnAccount;
|
||||
bool mHasAuthKey;
|
||||
RippleAddress mSigningPubKey;
|
||||
uint160 mTxnAccountID;
|
||||
STAmount mFeeDue;
|
||||
STAmount mPriorBalance; // Balance before fees.
|
||||
STAmount mSourceBalance; // Balance after fees.
|
||||
SLE::pointer mTxnAccount;
|
||||
bool mHasAuthKey;
|
||||
RippleAddress mSigningPubKey;
|
||||
|
||||
TER preCheck();
|
||||
TER checkSeq();
|
||||
|
||||
@@ -73,7 +73,6 @@ TER TrustSetTransactor::doApply()
|
||||
return tecNO_DST;
|
||||
}
|
||||
|
||||
const STAmount saSrcXRPBalance = mTxnAccount->getFieldAmount(sfBalance);
|
||||
const uint32 uOwnerCount = mTxnAccount->getFieldU32(sfOwnerCount);
|
||||
// The reserve required to create the line.
|
||||
const uint64 uReserveCreate = mEngine->getLedger()->getReserve(uOwnerCount + 1);
|
||||
@@ -263,7 +262,7 @@ TER TrustSetTransactor::doApply()
|
||||
mEngine->entryDelete(sleRippleState);
|
||||
}
|
||||
else if (bReserveIncrease
|
||||
&& saSrcXRPBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
&& mPriorBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Insufficent reserve to add trust line.";
|
||||
|
||||
@@ -286,7 +285,7 @@ TER TrustSetTransactor::doApply()
|
||||
|
||||
return tecNO_LINE_REDUNDANT;
|
||||
}
|
||||
else if (saSrcXRPBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
else if (mPriorBalance.getNValue() < uReserveCreate) // Reserve is not scaled by load.
|
||||
{
|
||||
cLog(lsINFO) << "doTrustSet: Delay transaction: Line does not exist. Insufficent reserve to create line.";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user