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