mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fixes for paths.
This commit is contained in:
@@ -361,16 +361,41 @@ bool STPathSet::isEquivalent(const SerializedType& t) const
|
||||
return v && (value == v->value);
|
||||
}
|
||||
|
||||
int STPath::getSerializeSize() const
|
||||
{
|
||||
int iBytes = 0;
|
||||
|
||||
BOOST_FOREACH(const STPathElement& speElement, mPath)
|
||||
{
|
||||
int iType = speElement.getNodeType();
|
||||
|
||||
iBytes += 1; // mType
|
||||
|
||||
if (iType & STPathElement::typeAccount)
|
||||
iBytes += 160/8;
|
||||
|
||||
if (iType & STPathElement::typeCurrency)
|
||||
iBytes += 160/8;
|
||||
|
||||
if (iType & STPathElement::typeIssuer)
|
||||
iBytes += 160/8;
|
||||
}
|
||||
|
||||
iBytes += 1; // typeBoundary | typeEnd
|
||||
|
||||
return iBytes;
|
||||
}
|
||||
|
||||
int STPathSet::getLength() const
|
||||
{
|
||||
// XXX This code is broken?
|
||||
assert(false);
|
||||
int ret = 0;
|
||||
int iBytes = 0;
|
||||
|
||||
for (std::vector<STPath>::const_iterator it = value.begin(), end = value.end(); it != end; ++it)
|
||||
ret += it->getSerializeSize();
|
||||
BOOST_FOREACH(const STPath& spPath, value)
|
||||
{
|
||||
iBytes += spPath.getSerializeSize();
|
||||
}
|
||||
|
||||
return (ret != 0) ? ret : (ret + 1);
|
||||
return iBytes ? iBytes : 1;
|
||||
}
|
||||
|
||||
Json::Value STPath::getJson(int) const
|
||||
|
||||
@@ -584,7 +584,7 @@ public:
|
||||
const STPathElement& getElemet(int offset) { return mPath[offset]; }
|
||||
void addElement(const STPathElement& e) { mPath.push_back(e); }
|
||||
void clear() { mPath.clear(); }
|
||||
int getSerializeSize() const { return 1 + mPath.size() * 21; }
|
||||
int getSerializeSize() const;
|
||||
// std::string getText() const;
|
||||
Json::Value getJson(int) const;
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ Transaction::pointer Transaction::setPayment(
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& spPaths)
|
||||
const STPathSet& spsPaths)
|
||||
{
|
||||
mTransaction->setITFieldAccount(sfDestination, naDstAccountID);
|
||||
mTransaction->setITFieldAmount(sfAmount, saAmount);
|
||||
@@ -505,9 +505,9 @@ Transaction::pointer Transaction::setPayment(
|
||||
mTransaction->setITFieldAmount(sfSendMax, saSendMax);
|
||||
}
|
||||
|
||||
if (spPaths.getPathCount())
|
||||
if (spsPaths.getPathCount())
|
||||
{
|
||||
mTransaction->setITFieldPathSet(sfPaths, spPaths);
|
||||
mTransaction->setITFieldPathSet(sfPaths, spsPaths);
|
||||
}
|
||||
|
||||
sign(naPrivateKey);
|
||||
@@ -524,11 +524,11 @@ Transaction::pointer Transaction::sharedPayment(
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& saPaths)
|
||||
const STPathSet& spsPaths)
|
||||
{
|
||||
pointer tResult = boost::make_shared<Transaction>(ttPAYMENT, naPublicKey, naSourceAccount, uSeq, saFee, uSourceTag);
|
||||
|
||||
return tResult->setPayment(naPrivateKey, naDstAccountID, saAmount, saSendMax, saPaths);
|
||||
return tResult->setPayment(naPrivateKey, naDstAccountID, saAmount, saSendMax, spsPaths);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& spPaths);
|
||||
const STPathSet& spsPaths);
|
||||
|
||||
Transaction::pointer setWalletAdd(
|
||||
const NewcoinAddress& naPrivateKey,
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
const NewcoinAddress& naDstAccountID,
|
||||
const STAmount& saAmount,
|
||||
const STAmount& saSendMax,
|
||||
const STPathSet& saPaths);
|
||||
const STPathSet& spsPaths);
|
||||
|
||||
// Place an offer.
|
||||
static Transaction::pointer sharedOfferCreate(
|
||||
|
||||
Reference in New Issue
Block a user