mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix transaction engine sense of ripple balances.
This commit is contained in:
@@ -105,7 +105,11 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
// Figure out the currency.
|
||||
//
|
||||
if (!currencyFromString(mCurrency, sCurrency))
|
||||
{
|
||||
Log(lsINFO) << "Currency malformed: " << sCurrency;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
mIsNative = !mCurrency;
|
||||
|
||||
@@ -116,13 +120,21 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
|
||||
// Issuer must be "" or a valid account string.
|
||||
if (!naIssuerID.setAccountID(sIssuer))
|
||||
{
|
||||
Log(lsINFO) << "Issuer malformed: " << sIssuer;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
mIssuer = naIssuerID.getAccountID();
|
||||
|
||||
// Stamps not must have an issuer.
|
||||
if (mIsNative && !mIssuer.isZero())
|
||||
{
|
||||
Log(lsINFO) << "Issuer specified for stamps: " << sIssuer;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64 uValue;
|
||||
int iOffset;
|
||||
@@ -137,6 +149,8 @@ bool STAmount::setFullValue(const std::string& sAmount, const std::string& sCurr
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Log(lsINFO) << "Bad integer amount: " << sAmount;
|
||||
|
||||
return false;
|
||||
}
|
||||
iOffset = 0;
|
||||
|
||||
@@ -48,7 +48,7 @@ Json::Value RPCServer::RPCError(int iError)
|
||||
{ rpcDST_AMT_MALFORMED, "dstAmtMalformed", "Destination amount/currency is malformed." },
|
||||
{ rpcFAIL_GEN_DECRPYT, "failGenDecrypt", "Failed to decrypt generator." },
|
||||
{ rpcGETS_ACT_MALFORMED, "getsActMalformed", "Gets account malformed." },
|
||||
{ rpcGETS_AMT_MALFORMED, "getsAmtMalformed", "Gets ammount malformed." },
|
||||
{ rpcGETS_AMT_MALFORMED, "getsAmtMalformed", "Gets amount malformed." },
|
||||
{ rpcHOST_IP_MALFORMED, "hostIpMalformed", "Host IP is malformed." },
|
||||
{ rpcINSUF_FUNDS, "insufFunds", "Insufficient funds." },
|
||||
{ rpcINTERNAL, "internal", "Internal error." },
|
||||
|
||||
@@ -224,8 +224,8 @@ STAmount TransactionEngine::rippleHolds(const uint160& uAccountID, const uint160
|
||||
{
|
||||
saBalance = sleRippleState->getIValueFieldAmount(sfBalance);
|
||||
|
||||
if (uAccountID < uIssuerID)
|
||||
saBalance.negate(); // Put balance in low terms.
|
||||
if (uAccountID > uIssuerID)
|
||||
saBalance.negate(); // Put balance in uAccountID terms.
|
||||
}
|
||||
|
||||
return saBalance;
|
||||
@@ -4213,7 +4213,7 @@ Log(lsWARNING) << "doOfferCreate: saTakerGets=" << saTakerGets.getFullText();
|
||||
}
|
||||
else if (!accountFunds(mTxnAccountID, saTakerGets).isPositive())
|
||||
{
|
||||
Log(lsWARNING) << "doOfferCreate: delay: offers must be funded";
|
||||
Log(lsWARNING) << "doOfferCreate: delay: Offers must be at least partially funded.";
|
||||
|
||||
terResult = terUNFUNDED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user