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