mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use STPathSet in place of STPath in transactions.
This commit is contained in:
@@ -429,7 +429,7 @@ Json::Value RPCServer::doSend(Json::Value& params)
|
||||
}
|
||||
else
|
||||
{
|
||||
STPath spPaths;
|
||||
STPathSet spPaths;
|
||||
Transaction::pointer trans = Transaction::sharedPayment(
|
||||
naAccountPublic, naAccountPrivate,
|
||||
naSrcAccountID,
|
||||
|
||||
@@ -564,12 +564,12 @@ void STObject::setValueFieldAmount(SOE_Field field, const STAmount &v)
|
||||
(*cf) = v;
|
||||
}
|
||||
|
||||
void STObject::setValueFieldPath(SOE_Field field, const STPath &v)
|
||||
void STObject::setValueFieldPathSet(SOE_Field field, const STPathSet &v)
|
||||
{
|
||||
SerializedType* rf = getPField(field);
|
||||
if (!rf) throw std::runtime_error("Field not found");
|
||||
if (rf->getSType() == STI_NOTPRESENT) rf = makeFieldPresent(field);
|
||||
STPath* cf = dynamic_cast<STPath*>(rf);
|
||||
STPathSet* cf = dynamic_cast<STPathSet*>(rf);
|
||||
if (!cf) throw std::runtime_error("Wrong field type");
|
||||
(*cf) = v;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
void setValueFieldAccount(SOE_Field field, const NewcoinAddress& addr)
|
||||
{ setValueFieldAccount(field, addr.getAccountID()); }
|
||||
void setValueFieldAmount(SOE_Field field, const STAmount&);
|
||||
void setValueFieldPath(SOE_Field field, const STPath&);
|
||||
void setValueFieldPathSet(SOE_Field field, const STPathSet&);
|
||||
|
||||
bool isFieldPresent(SOE_Field field) const;
|
||||
SerializedType* makeFieldPresent(SOE_Field field);
|
||||
|
||||
@@ -101,8 +101,8 @@ public:
|
||||
{ return mInnerTxn.setValueFieldAccount(field, v); }
|
||||
void setITFieldAmount(SOE_Field field, const STAmount& v)
|
||||
{ return mInnerTxn.setValueFieldAmount(field, v); }
|
||||
void setITFieldPath(SOE_Field field, const STPath& v)
|
||||
{ return mInnerTxn.setValueFieldPath(field, v); }
|
||||
void setITFieldPathSet(SOE_Field field, const STPathSet& v)
|
||||
{ return mInnerTxn.setValueFieldPathSet(field, v); }
|
||||
|
||||
// optional field functions
|
||||
bool getITFieldPresent(SOE_Field field) const;
|
||||
|
||||
@@ -406,3 +406,4 @@ void STPathSet::add(Serializer& s) const
|
||||
}
|
||||
s.add8(STPathElement::typeEnd);
|
||||
}
|
||||
// vim:ts=4
|
||||
|
||||
@@ -191,21 +191,19 @@ Transaction::pointer Transaction::setPayment(
|
||||
const NewcoinAddress& toAccount,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPath& spPaths)
|
||||
const STPathSet& spPaths)
|
||||
{
|
||||
mTransaction->setITFieldAccount(sfDestination, toAccount);
|
||||
mTransaction->setITFieldAmount(sfAmount, saAmount);
|
||||
|
||||
if (saAmount != saSendMax)
|
||||
{
|
||||
mTransaction->makeITFieldPresent(sfSendMax);
|
||||
mTransaction->setITFieldAmount(sfSendMax, saSendMax);
|
||||
}
|
||||
|
||||
if (!spPaths.emptyPath())
|
||||
if (spPaths.getPathCount())
|
||||
{
|
||||
mTransaction->makeITFieldPresent(sfPaths);
|
||||
mTransaction->setITFieldPath(sfPaths, spPaths);
|
||||
mTransaction->setITFieldPathSet(sfPaths, spPaths);
|
||||
}
|
||||
|
||||
sign(naPrivateKey);
|
||||
@@ -222,7 +220,7 @@ Transaction::pointer Transaction::sharedPayment(
|
||||
const NewcoinAddress& toAccount,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPath& saPaths)
|
||||
const STPathSet& saPaths)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT,
|
||||
naPublicKey, naSourceAccount,
|
||||
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
const NewcoinAddress& toAccount,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPath& spPaths);
|
||||
const STPathSet& spPaths);
|
||||
|
||||
public:
|
||||
Transaction(const SerializedTransaction::pointer st, bool bValidate);
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
const NewcoinAddress& toAccount,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPath& saPaths);
|
||||
const STPathSet& saPaths);
|
||||
|
||||
bool sign(const NewcoinAddress& naAccountPrivate);
|
||||
bool checkSign() const;
|
||||
|
||||
@@ -10,7 +10,7 @@ TransactionFormat InnerTxnFormats[]=
|
||||
{ S_FIELD(Destination), STI_ACCOUNT, SOE_REQUIRED, 0 },
|
||||
{ S_FIELD(Amount), STI_AMOUNT, SOE_REQUIRED, 0 },
|
||||
{ S_FIELD(SendMax), STI_AMOUNT, SOE_IFFLAG, 1 },
|
||||
{ S_FIELD(Paths), STI_PATH, SOE_IFFLAG, 2 },
|
||||
{ S_FIELD(Paths), STI_PATHSET, SOE_IFFLAG, 2 },
|
||||
{ S_FIELD(SourceTag), STI_UINT32, SOE_IFFLAG, 4 },
|
||||
{ S_FIELD(InvoiceID), STI_HASH256, SOE_IFFLAG, 8 },
|
||||
{ S_FIELD(Extensions), STI_TL, SOE_IFFLAG, 0x02000000 },
|
||||
|
||||
Reference in New Issue
Block a user