mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove destination field from credit_set transaction.
This commit is contained in:
@@ -1544,7 +1544,6 @@ Json::Value RPCServer::doRippleLineSet(const Json::Value& params)
|
||||
NewcoinAddress naSrcAccountID;
|
||||
NewcoinAddress naDstAccountID;
|
||||
STAmount saLimitAmount;
|
||||
bool bLimitAmount = true;
|
||||
bool bQualityIn = params.size() >= 6;
|
||||
bool bQualityOut = params.size() >= 7;
|
||||
uint32 uQualityIn = 0;
|
||||
@@ -1593,8 +1592,7 @@ Json::Value RPCServer::doRippleLineSet(const Json::Value& params)
|
||||
asSrc->getSeq(),
|
||||
theConfig.FEE_DEFAULT,
|
||||
0, // YYY No source tag
|
||||
naDstAccountID,
|
||||
bLimitAmount, saLimitAmount,
|
||||
saLimitAmount,
|
||||
bQualityIn, uQualityIn,
|
||||
bQualityOut, uQualityOut);
|
||||
|
||||
|
||||
@@ -744,7 +744,7 @@ void RippleCalc::calcNodeRipple(
|
||||
{
|
||||
const uint160 uCurrencyID = saCur.getCurrency();
|
||||
const uint160 uCurIssuerID = saCur.getIssuer();
|
||||
const uint160 uPrvIssuerID = saPrv.getIssuer();
|
||||
// const uint160 uPrvIssuerID = saPrv.getIssuer();
|
||||
|
||||
STAmount saCurIn = STAmount::divide(STAmount::multiply(saCur, uQualityOut, uCurrencyID, uCurIssuerID), uQualityIn, uCurrencyID, uCurIssuerID);
|
||||
|
||||
|
||||
@@ -256,18 +256,13 @@ Transaction::pointer Transaction::sharedCreate(
|
||||
|
||||
Transaction::pointer Transaction::setCreditSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
bool bLimitAmount,
|
||||
const STAmount& saLimitAmount,
|
||||
bool bQualityIn,
|
||||
uint32 uQualityIn,
|
||||
bool bQualityOut,
|
||||
uint32 uQualityOut)
|
||||
{
|
||||
mTransaction->setITFieldAccount(sfDestination, naDstAccountID);
|
||||
|
||||
if (bLimitAmount)
|
||||
mTransaction->setITFieldAmount(sfLimitAmount, saLimitAmount);
|
||||
mTransaction->setITFieldAmount(sfLimitAmount, saLimitAmount);
|
||||
|
||||
if (bQualityIn)
|
||||
mTransaction->setITFieldU32(sfQualityIn, uQualityIn);
|
||||
@@ -286,8 +281,6 @@ Transaction::pointer Transaction::sharedCreditSet(
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
bool bLimitAmount,
|
||||
const STAmount& saLimitAmount,
|
||||
bool bQualityIn,
|
||||
uint32 uQualityIn,
|
||||
@@ -296,8 +289,8 @@ Transaction::pointer Transaction::sharedCreditSet(
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttCREDIT_SET, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
return tResult->setCreditSet(naPrivateKey, naDstAccountID,
|
||||
bLimitAmount, saLimitAmount,
|
||||
return tResult->setCreditSet(naPrivateKey,
|
||||
saLimitAmount,
|
||||
bQualityIn, uQualityIn,
|
||||
bQualityOut, uQualityOut);
|
||||
}
|
||||
|
||||
@@ -74,8 +74,6 @@ private:
|
||||
|
||||
Transaction::pointer setCreditSet(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
bool bLimitAmount,
|
||||
const STAmount& saLimitAmount,
|
||||
bool bQualityIn,
|
||||
uint32 uQualityIn,
|
||||
@@ -185,8 +183,6 @@ public:
|
||||
uint32 uSeq,
|
||||
const STAmount& saFee,
|
||||
uint32 uSourceTag,
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
bool bLimitAmount,
|
||||
const STAmount& saLimitAmount,
|
||||
bool bQualityIn,
|
||||
uint32 uQualityIn,
|
||||
|
||||
@@ -241,8 +241,17 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
||||
TER terResult = tesSUCCESS;
|
||||
Log(lsINFO) << "doCreditSet>";
|
||||
|
||||
const STAmount saLimitAmount = txn.getITFieldAmount(sfLimitAmount);
|
||||
const bool bQualityIn = txn.getITFieldPresent(sfQualityIn);
|
||||
const uint32 uQualityIn = bQualityIn ? txn.getITFieldU32(sfQualityIn) : 0;
|
||||
const bool bQualityOut = txn.getITFieldPresent(sfQualityOut);
|
||||
const uint32 uQualityOut = bQualityIn ? txn.getITFieldU32(sfQualityOut) : 0;
|
||||
const uint160 uCurrencyID = saLimitAmount.getCurrency();
|
||||
uint160 uDstAccountID = saLimitAmount.getIssuer();
|
||||
const bool bFlipped = mTxnAccountID > uDstAccountID; // true, iff current is not lowest.
|
||||
bool bDelIndex = false;
|
||||
|
||||
// Check if destination makes sense.
|
||||
uint160 uDstAccountID = txn.getITFieldAccount(sfDestination);
|
||||
|
||||
if (!uDstAccountID)
|
||||
{
|
||||
@@ -265,23 +274,6 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
||||
return terNO_DST;
|
||||
}
|
||||
|
||||
const bool bFlipped = mTxnAccountID > uDstAccountID; // true, iff current is not lowest.
|
||||
const bool bLimitAmount = txn.getITFieldPresent(sfLimitAmount);
|
||||
const STAmount saLimitAmount = bLimitAmount ? txn.getITFieldAmount(sfLimitAmount) : STAmount();
|
||||
const bool bQualityIn = txn.getITFieldPresent(sfQualityIn);
|
||||
const uint32 uQualityIn = bQualityIn ? txn.getITFieldU32(sfQualityIn) : 0;
|
||||
const bool bQualityOut = txn.getITFieldPresent(sfQualityOut);
|
||||
const uint32 uQualityOut = bQualityIn ? txn.getITFieldU32(sfQualityOut) : 0;
|
||||
const uint160 uCurrencyID = saLimitAmount.getCurrency();
|
||||
bool bDelIndex = false;
|
||||
|
||||
if (bLimitAmount && saLimitAmount.getIssuer() != uDstAccountID)
|
||||
{
|
||||
Log(lsINFO) << "doCreditSet: Malformed transaction: issuer must be destination account.";
|
||||
|
||||
return temBAD_ISSUER;
|
||||
}
|
||||
|
||||
STAmount saLimitAllow = saLimitAmount;
|
||||
saLimitAllow.setIssuer(mTxnAccountID);
|
||||
|
||||
@@ -315,8 +307,7 @@ TER TransactionEngine::doCreditSet(const SerializedTransaction& txn)
|
||||
|
||||
if (!bDelIndex)
|
||||
{
|
||||
if (bLimitAmount)
|
||||
sleRippleState->setIFieldAmount(bFlipped ? sfHighLimit: sfLowLimit, saLimitAllow);
|
||||
sleRippleState->setIFieldAmount(bFlipped ? sfHighLimit: sfLowLimit, saLimitAllow);
|
||||
|
||||
if (!bQualityIn)
|
||||
{
|
||||
|
||||
@@ -27,11 +27,10 @@ TransactionFormat InnerTxnFormats[]=
|
||||
},
|
||||
{ "CreditSet", ttCREDIT_SET, {
|
||||
{ S_FIELD(Flags), STI_UINT32, SOE_FLAGS, 0 },
|
||||
{ S_FIELD(Destination), STI_ACCOUNT, SOE_REQUIRED, 0 },
|
||||
{ S_FIELD(SourceTag), STI_UINT32, SOE_IFFLAG, 1 },
|
||||
{ S_FIELD(LimitAmount), STI_AMOUNT, SOE_IFFLAG, 2 },
|
||||
{ S_FIELD(QualityIn), STI_UINT32, SOE_IFFLAG, 4 },
|
||||
{ S_FIELD(QualityOut), STI_UINT32, SOE_IFFLAG, 8 },
|
||||
{ S_FIELD(LimitAmount), STI_AMOUNT, SOE_REQUIRED, 0 },
|
||||
{ S_FIELD(QualityIn), STI_UINT32, SOE_IFFLAG, 1 },
|
||||
{ S_FIELD(QualityOut), STI_UINT32, SOE_IFFLAG, 2 },
|
||||
{ S_FIELD(SourceTag), STI_UINT32, SOE_IFFLAG, 4 },
|
||||
{ sfInvalid, NULL, STI_DONE, SOE_NEVER, -1 } }
|
||||
},
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user