Fix the bug Jed reported.

This commit is contained in:
JoelKatz
2012-06-29 02:07:24 -07:00
parent fcebbef0f4
commit 3f3ea3c594

View File

@@ -535,10 +535,13 @@ bool Transaction::save()
Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)
{
Serializer rawTxn(2048);
Serializer rawTxn;
std::string status;
uint32 inLedger;
int txSize = 2048;
rawTxn.resize(txSize);
{
ScopedLock sl(theApp->getTxnDB()->getDBLock());
Database* db = theApp->getTxnDB()->getDB();
@@ -548,15 +551,15 @@ Transaction::pointer Transaction::transactionFromSQL(const std::string& sql)
db->getStr("Status", status);
inLedger = db->getInt("LedgerSeq");
int txSize = db->getBinary("RawTxn", &*rawTxn.begin(), rawTxn.capacity());
if (txSize > rawTxn.size())
txSize = db->getBinary("RawTxn", &*rawTxn.begin(), rawTxn.getLength());
if (txSize > rawTxn.getLength())
{
rawTxn.resize(txSize);
db->getBinary("RawTxn", &*rawTxn.begin(), rawTxn.capacity());
db->getBinary("RawTxn", &*rawTxn.begin(), rawTxn.getLength());
}
else rawTxn.resize(txSize);
db->endIterRows();
}
rawTxn.resize(txSize);
SerializerIterator it(rawTxn);
SerializedTransaction::pointer txn = boost::make_shared<SerializedTransaction>(boost::ref(it));