diff --git a/src/cpp/ripple/LedgerEntrySet.cpp b/src/cpp/ripple/LedgerEntrySet.cpp index 45a226ece0..034bb696a6 100644 --- a/src/cpp/ripple/LedgerEntrySet.cpp +++ b/src/cpp/ripple/LedgerEntrySet.cpp @@ -328,8 +328,8 @@ bool LedgerEntrySet::threadTx(SLE::ref threadTo, Ledger::ref ledger, if (!threadTo->thread(mSet.getTxID(), mSet.getLgrSeq(), prevTxID, prevLgrID)) return false; - if (prevTxID.isZero() || TransactionMetaSet::thread(mSet.getAffectedNode(threadTo->getIndex(), sfModifiedNode), - prevTxID, prevLgrID)) + if (prevTxID.isZero() || + TransactionMetaSet::thread(mSet.getAffectedNode(threadTo, sfModifiedNode), prevTxID, prevLgrID)) return true; assert(false); @@ -408,8 +408,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s, TER result) if (type == &sfDeletedNode) { - assert(origNode); - assert(curNode); + assert(origNode && curNode); threadOwners(origNode, mLedger, newMod); // thread transaction to owners STObject prevs(sfPreviousFields); @@ -432,6 +431,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s, TER result) } else if (type == &sfModifiedNode) { + assert(curNode && origNode); if (curNode->isThreadedType()) // thread transaction to node it modified threadTx(curNode, mLedger, newMod); @@ -455,7 +455,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s, TER result) } else if (type == &sfCreatedNode) // if created, thread to owner(s) { - assert(!origNode); + assert(curNode && !origNode); threadOwners(curNode, mLedger, newMod); if (curNode->isThreadedType()) // always thread to self @@ -470,6 +470,7 @@ void LedgerEntrySet::calcRawMeta(Serializer& s, TER result) if (!news.empty()) mSet.getAffectedNode(it.first).addObject(news); } + else assert(false); } // add any new modified nodes to the modification set diff --git a/src/cpp/ripple/TransactionMeta.cpp b/src/cpp/ripple/TransactionMeta.cpp index f7b21bb8de..3f606e1467 100644 --- a/src/cpp/ripple/TransactionMeta.cpp +++ b/src/cpp/ripple/TransactionMeta.cpp @@ -79,12 +79,13 @@ std::vector TransactionMetaSet::getAffectedAccounts() } */ -STObject& TransactionMetaSet::getAffectedNode(const uint256& node, SField::ref type) +STObject& TransactionMetaSet::getAffectedNode(SLE::ref node, SField::ref type) { assert(&type); + uint256 index = node->getIndex(); BOOST_FOREACH(STObject& it, mNodes) { - if (it.getFieldH256(sfLedgerIndex) == node) + if (it.getFieldH256(sfLedgerIndex) == index) return it; } @@ -92,7 +93,8 @@ STObject& TransactionMetaSet::getAffectedNode(const uint256& node, SField::ref t STObject& obj = mNodes.back(); assert(obj.getFName() == type); - obj.setFieldH256(sfLedgerIndex, node); + obj.setFieldH256(sfLedgerIndex, index); + obj.setFieldU16(sfLedgerEntryType, node->getFieldU16(sfLedgerEntryType)); return obj; } diff --git a/src/cpp/ripple/TransactionMeta.h b/src/cpp/ripple/TransactionMeta.h index 66f57b1cb7..8ec2c12c8c 100644 --- a/src/cpp/ripple/TransactionMeta.h +++ b/src/cpp/ripple/TransactionMeta.h @@ -12,6 +12,7 @@ #include "Serializer.h" #include "SerializedTypes.h" #include "SerializedObject.h" +#include "SerializedLedger.h" #include "TransactionErr.h" class TransactionMetaSet @@ -42,7 +43,7 @@ public: bool isNodeAffected(const uint256&) const; void setAffectedNode(const uint256&, SField::ref type, uint16 nodeType); - STObject& getAffectedNode(const uint256&, SField::ref type); + STObject& getAffectedNode(SLE::ref node, SField::ref type); // create if needed STObject& getAffectedNode(const uint256&); const STObject& peekAffectedNode(const uint256&) const; //std::vector getAffectedAccounts();