From 52fda3f559d0d635874b42bfe3bbe8b0c616aef3 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 9 Jul 2013 09:42:52 -0700 Subject: [PATCH] If we encounter missing metadata, rebuild it. --- src/cpp/ripple/NetworkOPs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 7b9a78bb0..d37b12442 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -1236,6 +1236,15 @@ NetworkOPs::getAccountTxs (const RippleAddress& account, int32 minLedger, int32 ledger->pendSave(false); } + if (rawMeta.getLength() == 0) + { // Work around a bug that could leave the metadata missing + uint32 seq = static_cast(db->getBigInt("AccountTransactions.LedgerSeq")); + WriteLog(lsWARNING, NetworkOPs) << "Recovering ledger " << seq << ", txn " << txn->getID(); + Ledger::pointer ledger = getLedgerBySeq(seq); + if (ledger) + ledger->pendSave(false); + } + TransactionMetaSet::pointer meta = boost::make_shared (txn->getID (), txn->getLedger (), rawMeta.getData ()); ret.push_back (std::pair (txn, meta)); }