From acff2f45f10a3585fc272800fe6b4b2d48bcc5da Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Mon, 4 Feb 2013 15:39:53 -0800 Subject: [PATCH] Make hasSeen consider all elements of a path element. --- src/cpp/ripple/SerializedTypes.cpp | 12 ++++++++---- src/cpp/ripple/SerializedTypes.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cpp/ripple/SerializedTypes.cpp b/src/cpp/ripple/SerializedTypes.cpp index 11ed9794b2..46e599b4ff 100644 --- a/src/cpp/ripple/SerializedTypes.cpp +++ b/src/cpp/ripple/SerializedTypes.cpp @@ -415,16 +415,20 @@ bool STPathSet::isEquivalent(const SerializedType& t) const return v && (value == v->value); } -bool STPath::hasSeen(const uint160 &acct) { - - for (int i = 0; i < mPath.size();i++) { +bool STPath::hasSeen(const uint160 &uAccountId, const uint160& uCurrencyID, const uint160& uIssuerID) +{ + for (int i = 0; i < mPath.size(); ++i) { STPathElement ele = getElement(i); - if (ele.getAccountID() == acct) + + if (ele.getAccountID() == uAccountId + && ele.getCurrency() == uCurrencyID + && ele.getIssuerID() == uIssuerID) return true; } return false; } + int STPath::getSerializeSize() const { int iBytes = 0; diff --git a/src/cpp/ripple/SerializedTypes.h b/src/cpp/ripple/SerializedTypes.h index 2ca0d74211..0a05fa225f 100644 --- a/src/cpp/ripple/SerializedTypes.h +++ b/src/cpp/ripple/SerializedTypes.h @@ -623,7 +623,7 @@ public: const STPathElement& getElement(int offset) { return mPath[offset]; } void addElement(const STPathElement &e) { mPath.push_back(e); } void clear() { mPath.clear(); } - bool hasSeen(const uint160 &acct); + bool hasSeen(const uint160 &uAccountId, const uint160& uCurrencyID, const uint160& uIssuerID); int getSerializeSize() const; // std::string getText() const; Json::Value getJson(int) const;