diff --git a/src/cpp/ripple/Ledger.cpp b/src/cpp/ripple/Ledger.cpp index 860b50cdfd..e0f9589ebc 100644 --- a/src/cpp/ripple/Ledger.cpp +++ b/src/cpp/ripple/Ledger.cpp @@ -362,6 +362,23 @@ bool Ledger::getTransaction(const uint256& txID, Transaction::pointer& txn, Tran return true; } +bool Ledger::getTransactionMeta(const uint256& txID, TransactionMetaSet::pointer& meta) +{ + SHAMapTreeNode::TNType type; + SHAMapItem::pointer item = mTransactionMap->peekItem(txID, type); + if (!item) + return false; + + if (type != SHAMapTreeNode::tnTRANSACTION_MD) + return false; + + SerializerIterator it(item->peekSerializer()); + it.getVL(); // skip transaction + meta = boost::make_shared(txID, mLedgerSeq, it.getVL()); + + return true; +} + uint256 Ledger::getHash() { if (!mValidHash) diff --git a/src/cpp/ripple/Ledger.h b/src/cpp/ripple/Ledger.h index 97fc9c2b63..cf09383ac7 100644 --- a/src/cpp/ripple/Ledger.h +++ b/src/cpp/ripple/Ledger.h @@ -179,6 +179,7 @@ public: bool hasTransaction(const uint256& TransID) const { return mTransactionMap->hasItem(TransID); } Transaction::pointer getTransaction(const uint256& transID) const; bool getTransaction(const uint256& transID, Transaction::pointer& txn, TransactionMetaSet::pointer& txMeta); + bool getTransactionMeta(const uint256& transID, TransactionMetaSet::pointer& txMeta); static SerializedTransaction::pointer getSTransaction(SHAMapItem::ref, SHAMapTreeNode::TNType); SerializedTransaction::pointer getSMTransaction(SHAMapItem::ref, SHAMapTreeNode::TNType,