From c120a4cada3ea92d449f8bbeba0ddc0c1bff90f9 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 22 Aug 2012 08:03:29 -0700 Subject: [PATCH] Fix thread. New constructor. --- src/TransactionMeta.cpp | 16 ++++++++++------ src/TransactionMeta.h | 5 ++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/TransactionMeta.cpp b/src/TransactionMeta.cpp index 93f89652e..b193afb48 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 a6650a7b2..e3a5f359e 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&);