diff --git a/src/TransactionMeta.cpp b/src/TransactionMeta.cpp index 93f89652ef..b193afb48a 100644 --- a/src/TransactionMeta.cpp +++ b/src/TransactionMeta.cpp @@ -95,10 +95,9 @@ int TMNEAmount::compare(const TransactionMetaNodeEntry& e) const return 0; } -TMNEAccount::TMNEAccount(int type, SerializerIterator& sit) : TransactionMetaNodeEntry(type) -{ - mPrevAccount = sit.get256(); -} +TMNEAccount::TMNEAccount(int type, SerializerIterator& sit) + : TransactionMetaNodeEntry(type), mPrevAccount(sit.get256()) +{ ; } void TMNEAccount::addRaw(Serializer& sit) const { @@ -184,9 +183,14 @@ void TransactionMetaNode::addNode(TransactionMetaNodeEntry* node) mEntries.push_back(node); } -void TransactionMetaNode::thread(const uint256& prevTx, uint32 prevLgr) +bool TransactionMetaNode::thread(const uint256& prevTx, uint32 prevLgr) { - // WRITEME + for (boost::ptr_vector::iterator it = mEntries.begin(), end = mEntries.end(); + it != end; ++it) + if (it->getType() == TMSThread) + return false; + addNode(new TMNEThread(prevTx, prevLgr)); + return true; } Json::Value TransactionMetaNode::getJson(int v) const diff --git a/src/TransactionMeta.h b/src/TransactionMeta.h index a6650a7b28..e3a5f359eb 100644 --- a/src/TransactionMeta.h +++ b/src/TransactionMeta.h @@ -69,6 +69,9 @@ protected: public: TMNEThread() : TransactionMetaNodeEntry(TMSThread) { ; } + TMNEThread(uint256 prevTx, uint32 prevLgrSeq) + : TransactionMetaNodeEntry(TMSThread), mPrevTxID(prevTx), mPrevLgrSeq(prevLgrSeq) + { ; } TMNEThread(SerializerIterator&); virtual void addRaw(Serializer&) const; @@ -143,7 +146,7 @@ public: bool operator>(const TransactionMetaNode& n) const { return mNode > n.mNode; } bool operator>=(const TransactionMetaNode& n) const { return mNode >= n.mNode; } - void thread(const uint256& prevTx, uint32 prevLgr); + bool thread(const uint256& prevTx, uint32 prevLgr); TransactionMetaNode(int type, const uint256& node, SerializerIterator&); void addRaw(Serializer&);